osu-framework
osu-framework copied to clipboard
Fix potential startup crash if resolution/display pair from configuration results in no valid resolution
Closes https://github.com/ppy/osu/issues/19877#issuecomment-1221438234.
I wasn't able to reproduce what the user was seeing even when trying my best to break it, but have tested the flow works by artifically adding an exception:
diff --git a/osu.Framework/Platform/SDL2DesktopWindow.cs b/osu.Framework/Platform/SDL2DesktopWindow.cs
index 8ca11367f..d68d8368f 100644
--- a/osu.Framework/Platform/SDL2DesktopWindow.cs
+++ b/osu.Framework/Platform/SDL2DesktopWindow.cs
@@ -1233,6 +1233,9 @@ private void updateWindowStateAndSize()
{
var closestMode = getClosestDisplayMode(sizeFullscreen.Value, currentDisplayMode.Value.RefreshRate, currentDisplay.Index);
+ if (!sizeFullscreen.IsDefault)
+ throw new InvalidOperationException("test");
+
Size = new Size(closestMode.w, closestMode.h);
SDL.SDL_SetWindowDisplayMode(SDLWindowHandle, ref closestMode);