1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Move null check to menu item addition

This commit is contained in:
Joehu 2020-07-12 22:06:17 -07:00
parent ac7252e152
commit db6a9c9717

View File

@ -376,8 +376,8 @@ namespace osu.Game.Online.Leaderboards
{
List<MenuItem> items = new List<MenuItem>();
if (score.Mods.Length > 0 && modsContainer.Any(s => s.IsHovered))
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, getMods));
if (score.Mods.Length > 0 && modsContainer.Any(s => s.IsHovered) && songSelect != null)
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = score.Mods));
if (score.ID != 0)
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));
@ -385,11 +385,5 @@ namespace osu.Game.Online.Leaderboards
return items.ToArray();
}
}
private void getMods()
{
if (songSelect != null)
songSelect.Mods.Value = score.Mods;
}
}
}