diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-11 14:04:57 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-11 14:04:57 +0100 |
| commit | 6e0a3f03e7ae5d8155861f64cc4d10df56d9a199 (patch) | |
| tree | 2dc7dd153778f939da3d57e620c1748def614881 /FICS | |
| parent | 181596ddd7003d1523316f3b68bf477b53c14dbd (diff) | |
DisplayTargetRank: check the return value of GetRankFileName()
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/ratings.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c index 446a88d..05cd0b4 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -1905,29 +1905,25 @@ DisplayTargetRank(int p, char *target, int show, int showComp) int wildRank = -1, wildCount; 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) blitzRank = GetRank(fb, target, showComp); if (blitzRank < 0) 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) stdRank = GetRank(fs, target, showComp); if (stdRank < 0) ClearFlag(show, SHOW_STANDARD); } if (CheckFlag(show, SHOW_WILD)) { - GetRankFileName(Path, sizeof Path, TYPE_WILD); - - if (CheckFlag(show, SHOW_WILD)) - fw = fopen(Path, "r"); - if (fw != NULL) + if (GetRankFileName(Path, sizeof Path, TYPE_WILD) >= 0 && + (fw = fopen(Path, "r")) != NULL) wildRank = GetRank(fw, target, showComp); if (wildRank < 0) ClearFlag(show, SHOW_WILD); |
