From 64536f19f04976da00037e349ee665e7550fb2ca Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Thu, 9 Apr 2020 17:44:59 +0000 Subject: [PATCH] WindowServer: MenuManager::handle_mouse_event() return if window is null Previously the WindowServer would assert `topmost_menu->menu_window()` and crash. Fixes #1716 --- Servers/WindowServer/MenuManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Servers/WindowServer/MenuManager.cpp b/Servers/WindowServer/MenuManager.cpp index 6c371e7aff..995f9455fb 100644 --- a/Servers/WindowServer/MenuManager.cpp +++ b/Servers/WindowServer/MenuManager.cpp @@ -172,7 +172,10 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event) auto* topmost_menu = m_open_menu_stack.last().ptr(); ASSERT(topmost_menu); auto* window = topmost_menu->menu_window(); - ASSERT(window); + if (!window) { + dbg() << "MenuManager::handle_mouse_event: No menu window"; + return; + } ASSERT(window->is_visible()); bool event_is_inside_current_menu = window->rect().contains(mouse_event.position());