From ba8de14e8347a248298cd13205388992cc920cea Mon Sep 17 00:00:00 2001 From: cutealien Date: Sat, 14 Nov 2020 17:09:39 +0000 Subject: [PATCH] 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 --- source/Irrlicht/CGUIContextMenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp index 3a6484be..d38ceeda 100644 --- a/source/Irrlicht/CGUIContextMenu.cpp +++ b/source/Irrlicht/CGUIContextMenu.cpp @@ -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 ) {