Add non-null check to appease inspection

This commit is contained in:
Dean Herbert 2021-10-14 14:20:34 +09:00
parent ccc8012fd4
commit 364fa068b3

View File

@ -105,7 +105,11 @@ namespace osu.Game.Stores
{
var rulesets = realm.All<RealmRuleset>();
List<Ruleset> instances = loadedAssemblies.Values.Select(r => Activator.CreateInstance(r) as Ruleset).OfType<Ruleset>().ToList();
List<Ruleset> instances = loadedAssemblies.Values
.Select(r => Activator.CreateInstance(r) as Ruleset)
.Where(r => r != null)
.Cast<Ruleset>()
.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))