From a67a7229f87b5626fa65a1995bddb42ec970e38f Mon Sep 17 00:00:00 2001 From: Lorenzo Concas <35010999+lorenzoconcas@users.noreply.github.com> Date: Fri, 6 May 2022 16:42:35 +0200 Subject: [PATCH] WindowServer: Check that a menu is not null If an application menu is null, WindowServer crashes --- Userland/Services/WindowServer/Menu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 798bb2c468..13c65fa30e 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -178,7 +178,11 @@ void Menu::draw() m_theme_index_at_last_paint = MenuManager::the().theme_index(); VERIFY(menu_window()); - VERIFY(menu_window()->backing_store()); + + // When an application has an empty menu, we don't want to draw it + if (menu_window()->backing_store() == nullptr) + return; + Gfx::Painter painter(*menu_window()->backing_store()); Gfx::IntRect rect { {}, menu_window()->size() };