1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add null checks to prevent nullrefexception in automated test

This commit is contained in:
Shivam 2021-01-25 14:21:53 +01:00
parent 5e0ccb6c91
commit 6a85f5ca8b

View File

@ -42,7 +42,15 @@ namespace osu.Game.Tournament.Components
}
else
{
var modIcon = rulesets.GetRuleset(ladderInfo.Ruleset.Value.ID ?? 0).CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
var ruleset = rulesets.AvailableRulesets.FirstOrDefault(r => r == ladderInfo.Ruleset.Value);
if (ruleset == null)
return;
var modIcon = ruleset.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
if (modIcon == null)
return;
AddInternal(new ModIcon(modIcon)
{