From 9a091921f1131afe004bf0fb3e94a9f88e6b6713 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Sun, 5 Jan 2020 16:54:22 -0500 Subject: [PATCH] fix empty cookies --- src/webui.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/webui.c b/src/webui.c index 27f5b70..7858082 100644 --- a/src/webui.c +++ b/src/webui.c @@ -78,13 +78,16 @@ send_json_stats(struct evhttp_request *req, void *arg) hdrs_in = evhttp_request_get_input_headers(req); const char *cookies = evhttp_find_header(hdrs_in, "Cookie"); - char *wa = strstr(cookies, "wa="); - if (wa) + if (cookies) { - wa += 3; - mh = miner_hr(wa); - uint64_t balance = miner_balance(wa); - mb = (double) balance / 1000000000000.0; + char *wa = strstr(cookies, "wa="); + if (wa) + { + wa += 3; + mh = miner_hr(wa); + uint64_t balance = miner_balance(wa); + mb = (double) balance / 1000000000000.0; + } } evbuffer_add_printf(buf, "{"