From 1e2d9676c9e4340d3dc6dfd0b4ddbf3806f97a27 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Fri, 21 Jul 2023 20:22:31 +1000 Subject: [PATCH] Fixup not showing right menu options --- source/Core/Threads/OperatingModes/SettingsMenu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/Core/Threads/OperatingModes/SettingsMenu.cpp b/source/Core/Threads/OperatingModes/SettingsMenu.cpp index f3ce0652..ed3eca1a 100644 --- a/source/Core/Threads/OperatingModes/SettingsMenu.cpp +++ b/source/Core/Threads/OperatingModes/SettingsMenu.cpp @@ -86,13 +86,16 @@ OperatingMode moveToNextEntry(guiContext *cxt) { } } else { (*subEntry) += 1; + // If the new entry is null, we need to exit - if (subSettingsMenus[*mainEntry][*subEntry].draw == nullptr) { + if (subSettingsMenus[*mainEntry][(*subEntry) - 1].draw == nullptr) { (*subEntry) = 0; // Reset back to the main menu cxt->transitionMode = TransitionAnimation::Left; + // Have to break early to avoid the below check underflowing + return OperatingMode::SettingsMenu; } // Check if visible - if (subSettingsMenus[*mainEntry][*subEntry].isVisible != nullptr && !subSettingsMenus[*mainEntry][*subEntry].isVisible()) { + if (subSettingsMenus[*mainEntry][(*subEntry) - 1].isVisible != nullptr && !subSettingsMenus[*mainEntry][(*subEntry) - 1].isVisible()) { // We need to move on as this one isn't visible return moveToNextEntry(cxt); }