avoid a potential pop from empty stack

This commit is contained in:
Tim Felgentreff 2020-09-28 10:37:57 +02:00
parent f1f06fe6f5
commit 0043387f49

View file

@ -2432,8 +2432,11 @@ void MenuScreen::stop(int result, bool stopAll)
{
if (!this->runLoop) {
Gui->setTop(this->oldtop);
Assert(MenuStack.top() == this);
MenuStack.pop();
if (MenuStack.top() == this) {
MenuStack.pop();
} else {
DebugPrint("ALARM! A menu we're trying to stop is NOT at the top of the menu stack!!");
}
if (stopAll) {
while (!MenuStack.empty()) {
MenuStack.pop();