mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-01 12:00:27 +00:00
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 ^)
This commit is contained in:
parent
982eb996f7
commit
960df8a62a
Notes:
sideshowbarker
2024-07-19 09:32:59 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/960df8a62a3 Pull-request: https://github.com/SerenityOS/serenity/pull/1191
1 changed files with 5 additions and 1 deletions
|
@ -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<Gfx::Bitmap> 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<MenuItem>(*m_system_menu, app_identifier++, app.name, String(), true, false, false, Gfx::Bitmap::load_from_file(app.icon_path)));
|
||||
parent_menu->add_item(make<MenuItem>(*m_system_menu, app_identifier++, app.name, String(), true, false, false, icon));
|
||||
}
|
||||
|
||||
m_system_menu->add_item(make<MenuItem>(*m_system_menu, MenuItem::Separator));
|
||||
|
|
Loading…
Reference in a new issue