aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-25 01:23:47 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-25 01:23:47 +0100
commit30fba8781b8176fc31a914a98430bd567a8f1ad2 (patch)
treedab7d7d49142729ec3aa5626b1f4a3aa852ffc99
parentf812a813db207000a3a893b96a50ae3c539a9bbb (diff)
get_empty_slot: added null check (found by PVS-Studio)
-rw-r--r--FICS/gamedb.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index e436cab..27c7d6c 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -88,9 +88,11 @@ PRIVATE char gameString[GAME_STRING_LEN];
PRIVATE int
get_empty_slot(void)
{
- for (int i = 0; i < g_num; i++) {
- if (garray[i].status == GAME_EMPTY)
- return i;
+ if (garray != NULL) {
+ for (int i = 0; i < g_num; i++) {
+ if (garray[i].status == GAME_EMPTY)
+ return i;
+ }
}
g_num++;