Handle NULL hms buffer

This commit is contained in:
James R 2020-04-14 16:55:14 -07:00
parent 197cffb7f5
commit 9216406eea

View file

@ -211,6 +211,9 @@ HMS_fetch_rooms (int joining)
hms = HMS_connect("rooms"); hms = HMS_connect("rooms");
if (! hms)
return 0;
if (HMS_do(hms)) if (HMS_do(hms))
{ {
p = hms->buffer; p = hms->buffer;
@ -272,6 +275,9 @@ HMS_register (void)
hms = HMS_connect("rooms/%d/register", ms_RoomId); hms = HMS_connect("rooms/%d/register", ms_RoomId);
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0); title = curl_easy_escape(hms->curl, cv_servername.string, 0);
snprintf(post, sizeof post, snprintf(post, sizeof post,
@ -311,6 +317,9 @@ HMS_unlist (void)
hms = HMS_connect("servers/%s/unlist", hms_server_token); hms = HMS_connect("servers/%s/unlist", hms_server_token);
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hms->curl, CURLOPT_CUSTOMREQUEST, "POST");
HMS_do(hms); HMS_do(hms);
@ -331,6 +340,9 @@ HMS_update (void)
hms = HMS_connect("servers/%s/update", hms_server_token); hms = HMS_connect("servers/%s/update", hms_server_token);
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0); title = curl_easy_escape(hms->curl, cv_servername.string, 0);
snprintf(post, sizeof post, snprintf(post, sizeof post,
@ -357,6 +369,9 @@ HMS_list_servers (void)
hms = HMS_connect("servers"); hms = HMS_connect("servers");
if (! hms)
return;
if (HMS_do(hms)) if (HMS_do(hms))
{ {
p = &hms->buffer[strlen(hms->buffer)]; p = &hms->buffer[strlen(hms->buffer)];
@ -396,6 +411,9 @@ HMS_fetch_servers (msg_server_t *list, int room_number)
else else
hms = HMS_connect("servers"); hms = HMS_connect("servers");
if (! hms)
return NULL;
if (HMS_do(hms)) if (HMS_do(hms))
{ {
snprintf(local_version, sizeof local_version, snprintf(local_version, sizeof local_version,
@ -481,6 +499,9 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
hms = HMS_connect("versions/%d", MODID); hms = HMS_connect("versions/%d", MODID);
if (! hms)
return 0;
ok = 0; ok = 0;
if (HMS_do(hms)) if (HMS_do(hms))