1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 15:23:14 +08:00

Remove unnecessary null coalesce check

This commit is contained in:
Dean Herbert 2021-02-19 14:36:51 +09:00
parent df05c57f44
commit 39059ed82d

View File

@ -166,19 +166,21 @@ namespace osu.Game.Screens.OnlinePlay.Match
{
updateWorkingBeatmap();
if (SelectedItem.Value == null)
var selected = SelectedItem.Value;
if (selected == null)
return;
// Remove any user mods that are no longer allowed.
UserMods.Value = UserMods.Value
.Where(m => SelectedItem.Value.AllowedMods.Any(a => m.GetType() == a.GetType()))
.Where(m => selected.AllowedMods.Any(a => m.GetType() == a.GetType()))
.ToList();
UpdateMods();
Ruleset.Value = SelectedItem.Value.Ruleset.Value;
Ruleset.Value = selected.Ruleset.Value;
if (SelectedItem.Value?.AllowedMods.Any() != true)
if (selected.AllowedMods.Any() != true)
{
UserModsSection?.Hide();
userModsSelectOverlay.Hide();
@ -187,7 +189,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
else
{
UserModsSection?.Show();
userModsSelectOverlay.IsValidMod = m => SelectedItem.Value.AllowedMods.Any(a => a.GetType() == m.GetType());
userModsSelectOverlay.IsValidMod = m => selected.AllowedMods.Any(a => a.GetType() == m.GetType());
}
}