diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index b70fe2db4b..7f022bb653 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -189,19 +189,16 @@ bool Config::GameSettings::readFile( if (ignoreContent && (key == QLatin1String("content") || key == QLatin1String("data"))) continue; - QList values = cache.values(key); - values.append(settings.values(key)); - - bool exists = false; - for (const auto& existingValue : values) - { - if (existingValue.value == value.value) + auto containsValue = [&](const QMultiMap& map) { + for (auto [itr, end] = map.equal_range(key); itr != end; ++itr) { - exists = true; - break; + if (itr->value == value.value) + return true; } - } - if (!exists) + return false; + }; + + if (!containsValue(cache) && !containsValue(settings)) { cache.insert(key, value); }