1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 00:02:54 +08:00

Merge pull request #14695 from peppy/avoid-unnecessary-settings-copy

Avoid unnecessary mod settings copy attempt (when no settings exist to copy)
This commit is contained in:
Dean Herbert 2021-09-09 17:10:32 +09:00 committed by GitHub
commit b864b111d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,12 +53,15 @@ namespace osu.Game.Online.API
if (resultMod == null)
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
if (Settings.Count > 0)
{
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
continue;
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
{
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
continue;
resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
}
}
return resultMod;