From d87f876946872807fbfb0003c6702f6bdd916f34 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 15 Jul 2020 21:07:51 -0600 Subject: [PATCH] WindowServer: Fix crash when no active input window is set --- Services/WindowServer/MenuManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Services/WindowServer/MenuManager.cpp b/Services/WindowServer/MenuManager.cpp index 94cfa82a61..13f1b7c265 100644 --- a/Services/WindowServer/MenuManager.cpp +++ b/Services/WindowServer/MenuManager.cpp @@ -433,7 +433,10 @@ void MenuManager::set_current_menu(Menu* menu) auto& wm = WindowManager::the(); if (!previous_current_menu) { // When opening the first menu, store the current active input window - m_previous_input_window = wm.active_input_window()->make_weak_ptr(); + if (auto* active_input = wm.active_input_window()) + m_previous_input_window = active_input->make_weak_ptr(); + else + m_previous_input_window = nullptr; } wm.set_active_input_window(m_current_menu->menu_window());