1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:33:21 +08:00

Simplify null checks

This commit is contained in:
Dean Herbert 2018-09-07 14:31:38 +09:00
parent 8b217ad803
commit f76d00e8ae

View File

@ -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
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();
}
.ToList() ?? Enumerable.Empty<KeyValuePair<string, Size>>();
}
}