Avoid access allocation when CGUIContextMenu::setSubMenu receives a nullptr for menu.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6162 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-11-14 17:09:39 +00:00
parent 4cb289fc91
commit ba8de14e83

View File

@ -136,10 +136,10 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
Items[index].SubMenu->drop();
Items[index].SubMenu = menu;
menu->setVisible(false);
if (Items[index].SubMenu)
if (menu)
{
menu->setVisible(false);
menu->AllowFocus = false;
if ( Environment->getFocus() == menu )
{