mirror of https://github.com/ppy/osu
use null propragtor for Ruleset.Value and rulset instead of null checks
This commit is contained in:
parent
6a85f5ca8b
commit
a741d91aed
|
@ -18,14 +18,11 @@ public class TournamentModDisplay : CompositeDrawable
|
|||
{
|
||||
public string ModAcronym;
|
||||
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(TextureStore textures, LadderInfo ladderInfo)
|
||||
{
|
||||
var texture = textures.Get($"mods/{ModAcronym}");
|
||||
|
||||
|
@ -42,12 +39,8 @@ private void load(TextureStore textures)
|
|||
}
|
||||
else
|
||||
{
|
||||
var ruleset = rulesets.AvailableRulesets.FirstOrDefault(r => r == ladderInfo.Ruleset.Value);
|
||||
|
||||
if (ruleset == null)
|
||||
return;
|
||||
|
||||
var modIcon = ruleset.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
||||
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
|
||||
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
||||
|
||||
if (modIcon == null)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue