ref: d14238ea01e6b653f4153fe56e747e8c8a6a056a
parent: 73501fdb60004cff5845d617cbf1ce0e29f7a0cc
author: zamfofex <zamfofex@twdb.moe>
date: Mon Oct 9 13:02:19 EDT 2023
fix for when Lichess challenger is unregistered
--- a/tools/lichess.c
+++ b/tools/lichess.c
@@ -491,14 +491,17 @@
state = cJSON_GetObjectItem(root, "state");
if (!cJSON_IsObject(state)) moonfish_json_error(game->argv0);
+ white = 0;
+
white_player = cJSON_GetObjectItem(root, "white");
if (!cJSON_IsObject(white_player)) moonfish_json_error(game->argv0);
id = cJSON_GetObjectItem(white_player, "id");
- if (!cJSON_IsString(id)) moonfish_json_error(game->argv0);
-
- if (!strcmp(id->valuestring, game->username)) white = 1;
- else white = 0;
+ if (id != NULL && !cJSON_IsNull(id))
+ {+ if (!cJSON_IsString(id)) moonfish_json_error(game->argv0);
+ if (!strcmp(id->valuestring, game->username)) white = 1;
+ }
}
else
{--
⑨