From e87a69a5e7fd9cf2e51bcdff021de6d51d3426e6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 2 Feb 2024 22:31:20 +0100 Subject: [PATCH] Fix HideMapNamePopUpWindow possible overflow --- ld_script_modern.ld | 5 ----- src/map_name_popup.c | 9 +++++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 4f4bdae492..4ccbfbaa0f 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -15,11 +15,6 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - /* - We link malloc.o here to prevent `gHeap` from landing in the middle of EWRAM. - Otherwise this causes corruption issues on some ld versions - */ - gflib/malloc.o(ewram_data); src/*.o(ewram_data); gflib/*.o(ewram_data); } > EWRAM diff --git a/src/map_name_popup.c b/src/map_name_popup.c index eed2f2b714..d004b18d56 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -317,8 +317,13 @@ void HideMapNamePopUpWindow(void) { if (FuncIsActiveTask(Task_MapNamePopUpWindow)) { - ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE); - RemoveMapNamePopUpWindow(); + #ifdef UBFIX + if (GetMapNamePopUpWindowId() != WINDOW_NONE) + #endif // UBFIX + { + ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE); + RemoveMapNamePopUpWindow(); + } SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0); DestroyTask(sPopupTaskId); }