From 1241805747ad9500afb5eae7f1a9e79a12c9d754 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Fri, 1 Nov 2024 21:32:52 -0600 Subject: [PATCH] Wood theme: Fix crash when pressing D-Pad Right with 2 files/folders or less on-screen --- romsel_aktheme/arm9/source/fileBrowse.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/romsel_aktheme/arm9/source/fileBrowse.cpp b/romsel_aktheme/arm9/source/fileBrowse.cpp index d173267dde..8ce6df331a 100644 --- a/romsel_aktheme/arm9/source/fileBrowse.cpp +++ b/romsel_aktheme/arm9/source/fileBrowse.cpp @@ -1523,7 +1523,10 @@ std::string browseForFile(const std::vector extensionList) { fileOffset += entriesPerScreen; screenOffset += entriesPerScreen; if (fileOffset > (int)dirContents.size() - 1) fileOffset = (int)dirContents.size() - 1; - if (screenOffset > (int)dirContents.size() - entriesPerScreen) screenOffset = (int)dirContents.size() - entriesPerScreen; + if (screenOffset > (int)dirContents.size() - entriesPerScreen) { + screenOffset = (int)dirContents.size() - entriesPerScreen; + if (screenOffset < 0) screenOffset = 0; + } cursorPosOnScreen = fileOffset - screenOffset; if (cursorPosOnScreen > entriesPerScreen - 1) cursorPosOnScreen = entriesPerScreen - 1; resetIconScale();