diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-16 22:32:25 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-16 22:32:25 +0800 |
commit | a9f1c29a36e1a98c04a9cfc04b0a38aaef48bc9e (patch) | |
tree | 8e1ea2fcdbaa8098302b8a52b2f0ba883fcdc54d | |
parent | adbe76047fc207eb09a2e03d4231e0713360140f (diff) |
Handler gets used only if it's not NULL
-rw-r--r-- | request.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 { |