Explorar el Código

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

There isn't always a hovered item, so let's not assume things.
Andreas Kling hace 4 años
padre
commit
17e25890be
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  1. 1 2
      Services/WindowServer/MenuManager.cpp

+ 1 - 2
Services/WindowServer/MenuManager.cpp

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