mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Simplify null checks
This commit is contained in:
parent
8b217ad803
commit
f76d00e8ae
@ -101,18 +101,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
}, true);
|
||||
}
|
||||
|
||||
private List<KeyValuePair<string, Size>> getResolutions()
|
||||
{
|
||||
if (game.Window == null)
|
||||
return new List<KeyValuePair<string, Size>>();
|
||||
|
||||
return game.Window?.AvailableResolutions
|
||||
.Where(r => r.Width >= 800 && r.Height >= 600)
|
||||
.OrderByDescending(r => r.Width)
|
||||
.ThenByDescending(r => r.Height)
|
||||
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
private IEnumerable<KeyValuePair<string, Size>> getResolutions() =>
|
||||
game.Window?.AvailableResolutions?
|
||||
.Where(r => r.Width >= 800 && r.Height >= 600)
|
||||
.OrderByDescending(r => r.Width)
|
||||
.ThenByDescending(r => r.Height)
|
||||
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
||||
.Distinct()
|
||||
.ToList() ?? Enumerable.Empty<KeyValuePair<string, Size>>();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user