Prevent feedback by using atomic .ReplaceRange()

`display.NewValue` will never be null, checked on SDL + osuTK/Android.

On Android it's a 0x0 display, importantly not null.
This commit is contained in:
Susko3 2023-05-16 21:57:31 +02:00
parent 732bd7812b
commit 2d7fe68311

View File

@ -193,16 +193,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
currentDisplay.BindValueChanged(display => Schedule(() =>
{
resolutions.RemoveRange(1, resolutions.Count - 1);
if (display.NewValue != null)
{
resolutions.AddRange(display.NewValue.DisplayModes
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
.Select(m => m.Size)
.Distinct());
}
resolutions.ReplaceRange(1, resolutions.Count - 1, display.NewValue.DisplayModes
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
.Select(m => m.Size)
.Distinct());
updateDisplaySettingsVisibility();
}), true);