1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

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
parent 6bb6176762
commit 353bf57378

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();