summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-12-05 12:10:17 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-01 15:40:39 +0100
commit13acf603d8c9cc2b75974ea3f2ad5ef4a5682671 (patch)
tree3c9bd55f1da3331dc0298ed07fae03976f49e19e /Userland
parentb7c0c32f24c2028453b5c6a402f5068717cd773c (diff)
downloadserenity-13acf603d8c9cc2b75974ea3f2ad5ef4a5682671.zip
LibGUI: Avoid unnecessary copies in FileIconProvider
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp
index 8b2c14c778..dbed2680ca 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.cpp
+++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp
@@ -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();
}