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

WindowServer: Fix crash when no active input window is set

This commit is contained in:
Tom 2020-07-15 21:07:51 -06:00 committed by Andreas Kling
parent a269e3e573
commit d87f876946

View file

@ -433,7 +433,10 @@ void MenuManager::set_current_menu(Menu* menu)
auto& wm = WindowManager::the(); auto& wm = WindowManager::the();
if (!previous_current_menu) { if (!previous_current_menu) {
// When opening the first menu, store the current active input window // 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()); wm.set_active_input_window(m_current_menu->menu_window());