From 788ad9b57d9c10c73cc1fff1d3a3cf06095a5227 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 11 Mar 2026 14:05:30 +0100 Subject: DisplayRankedPlayers: check the return value of GetRankFileName() --- FICS/ratings.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/FICS/ratings.c b/FICS/ratings.c index 05cd0b4..f69546b 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -1976,21 +1976,18 @@ DisplayRankedPlayers(int p, int start, int end, int show, int showComp) num = 100; if (CheckFlag(show, SHOW_BLITZ)) { - GetRankFileName(Path, sizeof Path, TYPE_BLITZ); - - if ((fb = fopen(Path, "r")) == NULL) + if (GetRankFileName(Path, sizeof Path, TYPE_BLITZ) >= 0 && + (fb = fopen(Path, "r")) == NULL) ClearFlag(show, SHOW_BLITZ); } if (CheckFlag(show, SHOW_STANDARD)) { - GetRankFileName(Path, sizeof Path, TYPE_STAND); - - if ((fs = fopen(Path, "r")) == NULL) + if (GetRankFileName(Path, sizeof Path, TYPE_STAND) >= 0 && + (fs = fopen(Path, "r")) == NULL) ClearFlag(show, SHOW_STANDARD); } if (CheckFlag(show, SHOW_WILD)) { - GetRankFileName(Path, sizeof Path, TYPE_WILD); - - if ((fw = fopen(Path, "r")) == NULL) + if (GetRankFileName(Path, sizeof Path, TYPE_WILD) >= 0 && + (fw = fopen(Path, "r")) == NULL) ClearFlag(show, SHOW_WILD); } -- cgit v1.2.3