fix empty cookies

This commit is contained in:
Jethro Grassie 2020-01-05 16:54:22 -05:00
parent 56df00634f
commit 9a091921f1
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
1 changed files with 9 additions and 6 deletions

View File

@ -78,13 +78,16 @@ send_json_stats(struct evhttp_request *req, void *arg)
hdrs_in = evhttp_request_get_input_headers(req); hdrs_in = evhttp_request_get_input_headers(req);
const char *cookies = evhttp_find_header(hdrs_in, "Cookie"); const char *cookies = evhttp_find_header(hdrs_in, "Cookie");
char *wa = strstr(cookies, "wa="); if (cookies)
if (wa)
{ {
wa += 3; char *wa = strstr(cookies, "wa=");
mh = miner_hr(wa); if (wa)
uint64_t balance = miner_balance(wa); {
mb = (double) balance / 1000000000000.0; wa += 3;
mh = miner_hr(wa);
uint64_t balance = miner_balance(wa);
mb = (double) balance / 1000000000000.0;
}
} }
evbuffer_add_printf(buf, "{" evbuffer_add_printf(buf, "{"