diff --git a/osu.Game/Stores/RealmRulesetStore.cs b/osu.Game/Stores/RealmRulesetStore.cs index ec395bf774..fb512692d6 100644 --- a/osu.Game/Stores/RealmRulesetStore.cs +++ b/osu.Game/Stores/RealmRulesetStore.cs @@ -105,7 +105,11 @@ namespace osu.Game.Stores { var rulesets = realm.All(); - List instances = loadedAssemblies.Values.Select(r => Activator.CreateInstance(r) as Ruleset).OfType().ToList(); + List instances = loadedAssemblies.Values + .Select(r => Activator.CreateInstance(r) as Ruleset) + .Where(r => r != null) + .Cast() + .ToList(); // add all legacy rulesets first to ensure they have exclusive choice of primary key. foreach (var r in instances.Where(r => r is ILegacyRuleset))