mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 05:43:18 +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:
commit
b864b111d6
@ -53,6 +53,8 @@ namespace osu.Game.Online.API
|
|||||||
if (resultMod == null)
|
if (resultMod == null)
|
||||||
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
||||||
|
|
||||||
|
if (Settings.Count > 0)
|
||||||
|
{
|
||||||
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
|
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
|
||||||
{
|
{
|
||||||
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
||||||
@ -60,6 +62,7 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
|
resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return resultMod;
|
return resultMod;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user