From bc22d17a164ada6432cdec28c77b5401c3102930 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 5 May 2024 15:10:45 +0200 Subject: [PATCH] fixed a possible crash with bad Steam data --- scores.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scores.cpp b/scores.cpp index 17c7a0ed..dd269b11 100644 --- a/scores.cpp +++ b/scores.cpp @@ -108,7 +108,11 @@ string displayfor(int scoredisplay, score* S, bool shorten = false) { return buf; } if(scoredisplay == POSSCORE) return modedesc(S); - if(scoredisplay == 68) return S->yasc_message + XLAT(" in %the1", eLand(S->box[68])); + if(scoredisplay == 68) { + eLand which = eLand(S->box[68]); + if(which >= landtypes || which < 0) return "fail"; + return S->yasc_message + XLAT(" in %the1", which); + } if(scoredisplay == 1) { time_t tim = S->box[1]; char buf[128]; strftime(buf, 128, "%c", localtime(&tim));