1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibGUI: Don't crash when updating menu item that's not in the window server (#83)

Don't crash when updating menu item that's not in the window server. Menu Items begin with an invalid ID of -1, and only get a valid ID if the menu they are attached to is added to the window server. They don't send updates to the server unless they have a valid ID.

Fixes #82
This commit is contained in:
Christopher Dumas 2019-05-23 19:31:00 -07:00 committed by Andreas Kling
parent ebf645d72a
commit 9823354754
4 changed files with 7 additions and 2 deletions

View file

@ -46,6 +46,8 @@ void GMenuItem::set_checked(bool checked)
void GMenuItem::update_window_server()
{
if (m_menu_id < 0)
return;
auto& action = *m_action;
WSAPI_ClientMessage request;
request.type = WSAPI_ClientMessage::Type::UpdateMenuItem;