WindowServer: Don't crash when trying to close an empty menu

It's not normal to add empty menus to an app's menubar, but just in
case someone does it anyway, let's not crash trying to close it.
This commit is contained in:
Andreas Kling 2019-09-01 13:24:57 +02:00
commit 353bf57378
Notes: sideshowbarker 2024-07-19 12:25:47 +09:00

View file

@ -402,7 +402,7 @@ void WSWindowManager::close_current_menu()
m_current_menu->menu_window()->set_visible(false);
m_current_menu = nullptr;
for (auto& menu : m_menu_manager.open_menu_stack()) {
if (menu)
if (menu && menu->menu_window())
menu->menu_window()->set_visible(false);
}
m_menu_manager.open_menu_stack().clear();