LibGUI: Avoid unnecessary copies in FileIconProvider

This commit is contained in:
Ben Wiederhake 2021-12-05 12:10:17 +01:00 committed by Andreas Kling
parent b7c0c32f24
commit 13acf603d8
Notes: sideshowbarker 2024-07-17 21:50:17 +09:00

View file

@ -267,8 +267,10 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode)
return s_filetype_image_icon;
for (auto& filetype : s_filetype_icons.keys()) {
auto patterns = s_filetype_patterns.get(filetype).value();
for (auto& pattern : patterns) {
auto pattern_it = s_filetype_patterns.find(filetype);
if (pattern_it == s_filetype_patterns.end())
continue;
for (auto& pattern : pattern_it->value) {
if (path.matches(pattern, CaseSensitivity::CaseInsensitive))
return s_filetype_icons.get(filetype).value();
}