WindowServer: Don't crash when pressing return after opening menu

There isn't always a hovered item, so let's not assume things.
This commit is contained in:
Andreas Kling 2020-12-07 19:26:25 +01:00
parent 358ec1f1eb
commit 17e25890be
Notes: sideshowbarker 2024-07-19 01:00:36 +09:00

View File

@ -181,8 +181,7 @@ void MenuManager::event(Core::Event& event)
if (key_event.key() == Key_Return) {
auto hovered_item = m_current_menu->hovered_item();
if (!hovered_item->is_enabled())
if (!hovered_item || !hovered_item->is_enabled())
return;
if (hovered_item->is_submenu())
m_current_menu->descend_into_submenu_at_hovered_item();