1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +08:00

Avoid settings copy if there are no settings

This commit is contained in:
Dean Herbert 2021-09-09 15:43:55 +09:00
parent 38f4b0ced2
commit e66d76d26e

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;