summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-16 22:32:25 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-16 22:32:25 +0800
commita9f1c29a36e1a98c04a9cfc04b0a38aaef48bc9e (patch)
tree8e1ea2fcdbaa8098302b8a52b2f0ba883fcdc54d
parentadbe76047fc207eb09a2e03d4231e0713360140f (diff)
Handler gets used only if it's not NULL
-rw-r--r--request.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/request.h b/request.h
index 756edd7..7960561 100644
--- a/request.h
+++ b/request.h
@@ -107,7 +107,8 @@ static inline void request(void (*handler)(icclient_fetch_t *), void *callback,
va_end(ap);
#ifdef __EMSCRIPTEN__
- attr.onsuccess = handler;
+ if (handler)
+ attr.onsuccess = handler;
attr.userData = callback;
strcpy(attr.requestMethod, "GET");
emscripten_fetch(&attr, url);
@@ -134,7 +135,7 @@ static inline void request(void (*handler)(icclient_fetch_t *), void *callback,
CURLcode res = curl_easy_perform(curl);
if (post)
curl_formfree(post);
- if (res == CURLE_OK)
+ if (res == CURLE_OK && handler)
handler(&fetch);
#ifdef DEBUG
else {