mirror of
https://github.com/ppy/osu
synced 2024-12-11 17:42:28 +00:00
Guard against a potential startup crash if user's preferred ruleset has a compatibility issue
Resolves this issue seen at https://github.com/ppy/osu/issues/13722#issuecomment-872088071.
This commit is contained in:
parent
82fd8b13df
commit
3816c486d5
@ -223,7 +223,20 @@ namespace osu.Game
|
||||
|
||||
// bind config int to database RulesetInfo
|
||||
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
||||
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
|
||||
|
||||
var preferredRuleset = RulesetStore.GetRuleset(configRuleset.Value);
|
||||
|
||||
try
|
||||
{
|
||||
Ruleset.Value = preferredRuleset ?? RulesetStore.AvailableRulesets.First();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// on startup, a ruleset may be selected which has compatibility issues.
|
||||
Logger.Error(e, $@"Failed to switch to preferred ruleset {preferredRuleset}.");
|
||||
Ruleset.Value = RulesetStore.AvailableRulesets.First();
|
||||
}
|
||||
|
||||
Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
|
||||
|
||||
// bind config int to database SkinInfo
|
||||
|
Loading…
Reference in New Issue
Block a user