From a9f1c29a36e1a98c04a9cfc04b0a38aaef48bc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Wed, 16 Jun 2021 22:32:25 +0800 Subject: Handler gets used only if it's not NULL --- request.h | 5 +++-- 1 file 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 { -- cgit v1.2.3