From 30fba8781b8176fc31a914a98430bd567a8f1ad2 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 25 Nov 2024 01:23:47 +0100 Subject: get_empty_slot: added null check (found by PVS-Studio) --- FICS/gamedb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'FICS/gamedb.c') 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++; -- cgit v1.2.3