Skip to content

Commit 39471c2

Browse files
committed
[[ Bug 19536 ]] Ensure parent is submenu
This patch checks that the parent of the parent of a menu is a button. This will be the case if it is a submenu and we should continue iterating the menu tree to confirm the click was outside a menu.
1 parent 3bda1d4 commit 39471c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

engine/src/button.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,9 @@ Boolean MCButton::mup(uint2 which, bool p_release)
13841384

13851385
// Move to the parent menu, if it exists
13861386
if (t_menu->getstack()->getparent() // Stack's parent
1387-
&& t_menu->getstack()->getparent()->gettype() == CT_BUTTON)
1387+
&& t_menu->getstack()->getparent()->gettype() == CT_BUTTON
1388+
&& t_menu->getstack()->getparent()->getstack()->getparent()
1389+
&& t_menu->getstack()->getparent()->getstack()->getparent()->gettype() == CT_BUTTON)
13881390
{
13891391
// This is a submenu
13901392
t_menu = t_menu->getstack()->getparent();

0 commit comments

Comments
 (0)