From f76d00e8aee43920d978e6551d3c0b52e7312ee7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Sep 2018 14:31:38 +0900 Subject: [PATCH] Simplify null checks --- .../Sections/Graphics/LayoutSettings.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 4d3cdacb6a..0c463ce142 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -101,18 +101,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - private List> getResolutions() - { - if (game.Window == null) - return new List>(); - - return game.Window?.AvailableResolutions - .Where(r => r.Width >= 800 && r.Height >= 600) - .OrderByDescending(r => r.Width) - .ThenByDescending(r => r.Height) - .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) - .Distinct() - .ToList(); - } + private IEnumerable> getResolutions() => + game.Window?.AvailableResolutions? + .Where(r => r.Width >= 800 && r.Height >= 600) + .OrderByDescending(r => r.Width) + .ThenByDescending(r => r.Height) + .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) + .Distinct() + .ToList() ?? Enumerable.Empty>(); } }