From 0043387f496ed22288e0d2ee150909de59c612e0 Mon Sep 17 00:00:00 2001
From: Tim Felgentreff <timfelgentreff@gmail.com>
Date: Mon, 28 Sep 2020 10:37:57 +0200
Subject: [PATCH] avoid a potential pop from empty stack

---
 src/ui/widgets.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/ui/widgets.cpp b/src/ui/widgets.cpp
index b2c27f52a..a04005d49 100644
--- a/src/ui/widgets.cpp
+++ b/src/ui/widgets.cpp
@@ -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();