From 960df8a62a31415eea33cee7c840daacbed3ed9c Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Fri, 7 Feb 2020 12:29:37 +0300 Subject: [PATCH] WindowServer: Don't try to load unspecified icons Some apps (looking at you, VisualBuilder) don't specify an icon in their .af file, so WindowServer was trying to open an empty path. That made it print a perror message to the log each time. Let's not do that ^) --- Servers/WindowServer/MenuManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Servers/WindowServer/MenuManager.cpp b/Servers/WindowServer/MenuManager.cpp index 46605a4e2e..ba0e4288b2 100644 --- a/Servers/WindowServer/MenuManager.cpp +++ b/Servers/WindowServer/MenuManager.cpp @@ -102,8 +102,12 @@ MenuManager::MenuManager() // Then we create and insert all the app menu items into the right place. int app_identifier = 1; for (const auto& app : m_apps) { + RefPtr icon; + if (!app.icon_path.is_empty()) + icon = Gfx::Bitmap::load_from_file(app.icon_path); + auto parent_menu = m_app_category_menus.get(app.category).value_or(*m_system_menu); - parent_menu->add_item(make(*m_system_menu, app_identifier++, app.name, String(), true, false, false, Gfx::Bitmap::load_from_file(app.icon_path))); + parent_menu->add_item(make(*m_system_menu, app_identifier++, app.name, String(), true, false, false, icon)); } m_system_menu->add_item(make(*m_system_menu, MenuItem::Separator));