From 182a094f2bb7881575a5798aed991debebf6265a Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 16 Sep 2015 10:52:02 -0300 Subject: [PATCH] Add some checks to Menu::closeAll() to avoid accessing null pointers These are not reproducible situations, but we've received a crash report that indicates that these pointers can be null if some unknown scenario. --- src/ui/menu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ui/menu.cpp b/src/ui/menu.cpp index 9f98d68dc..1b4c06d70 100644 --- a/src/ui/menu.cpp +++ b/src/ui/menu.cpp @@ -1125,7 +1125,15 @@ void Menu::closeAll() } MenuBox* base_menubox = get_base_menubox(menu->getParent()); + ASSERT(base_menubox); + if (!base_menubox) + return; + MenuBaseData* base = base_menubox->getBase(); + ASSERT(base); + if (!base) + return; + base->close_all = true; base->was_clicked = false; if (base->is_filtering) {