mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
WindowServer: Don't crash when trying to open an empty menu.
This commit is contained in:
parent
3085e400bc
commit
627e06632a
2 changed files with 6 additions and 3 deletions
|
@ -387,9 +387,11 @@ void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, WSMouseEvent& event)
|
|||
if (m_current_menu == &menu)
|
||||
return;
|
||||
close_current_menu();
|
||||
auto& menu_window = menu.ensure_menu_window();
|
||||
menu_window.move_to({ menu.rect_in_menubar().x(), menu.rect_in_menubar().bottom() });
|
||||
menu_window.set_visible(true);
|
||||
if (!menu.is_empty()) {
|
||||
auto& menu_window = menu.ensure_menu_window();
|
||||
menu_window.move_to({ menu.rect_in_menubar().x(), menu.rect_in_menubar().bottom() });
|
||||
menu_window.set_visible(true);
|
||||
}
|
||||
m_current_menu = &menu;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue