mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Fix crash on trying to retrieve mods from unavailable ruleset (#7211)
Fix crash on trying to retrieve mods from unavailable ruleset
This commit is contained in:
commit
23ea6c1e6c
@ -84,6 +84,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public override Ruleset CreateInstance() => new TestCustomisableModRuleset();
|
||||
|
||||
public TestRulesetInfo()
|
||||
{
|
||||
Available = true;
|
||||
}
|
||||
|
||||
public class TestCustomisableModRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
|
@ -246,8 +246,11 @@ namespace osu.Game
|
||||
{
|
||||
var dict = new Dictionary<ModType, IReadOnlyList<Mod>>();
|
||||
|
||||
foreach (ModType type in Enum.GetValues(typeof(ModType)))
|
||||
dict[type] = r.NewValue?.CreateInstance().GetModsFor(type).ToList();
|
||||
if (r.NewValue?.Available == true)
|
||||
{
|
||||
foreach (ModType type in Enum.GetValues(typeof(ModType)))
|
||||
dict[type] = r.NewValue.CreateInstance().GetModsFor(type).ToList();
|
||||
}
|
||||
|
||||
if (!SelectedMods.Disabled)
|
||||
SelectedMods.Value = Array.Empty<Mod>();
|
||||
|
Loading…
Reference in New Issue
Block a user