From 2fea65b8ef7953e80b362585a01d3e42c53b640b Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 13 Feb 2022 16:47:42 -0800 Subject: [PATCH] Fix crash in get_level_name() --- src/game/level_info.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/game/level_info.c b/src/game/level_info.c index 51e40dd8..392e1493 100644 --- a/src/game/level_info.c +++ b/src/game/level_info.c @@ -106,7 +106,7 @@ const char* get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex) { } // If we are in in Course 0 we are in the castle which doesn't have a string - if (courseNum) { + if (courseNum && courseNum > 0 && courseNum < 27) { void** courseNameTbl; #ifndef VERSION_EU @@ -127,8 +127,7 @@ const char* get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex) { u8* courseName = segmented_to_virtual(courseNameTbl[courseNum - 1]); convert_string(&courseName[3], stage); - } - else { + } else { strcpy(stage, "Peach's Castle"); }