diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-11-25 01:23:47 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-11-25 01:23:47 +0100 |
commit | 30fba8781b8176fc31a914a98430bd567a8f1ad2 (patch) | |
tree | dab7d7d49142729ec3aa5626b1f4a3aa852ffc99 | |
parent | f812a813db207000a3a893b96a50ae3c539a9bbb (diff) |
get_empty_slot: added null check (found by PVS-Studio)
-rw-r--r-- | FICS/gamedb.c | 8 |
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++; |