From 46dfb309bc9173e93a80397c25a8e279cf1147be Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 7 Jan 2023 12:49:11 +0100 Subject: [PATCH] Fix #10309: [SDL] Uninitialized width and height when turning off full screen --- src/video/sdl2_v.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 5f6950a8e1..51c490d231 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -648,12 +648,11 @@ bool VideoDriver_SDL_Base::ChangeResolution(int w, int h) bool VideoDriver_SDL_Base::ToggleFullscreen(bool fullscreen) { - int w, h; - /* Remember current window size */ - if (fullscreen) { - SDL_GetWindowSize(this->sdl_window, &w, &h); + int w, h; + SDL_GetWindowSize(this->sdl_window, &w, &h); + if (fullscreen) { /* Find fullscreen window size */ SDL_DisplayMode dm; if (SDL_GetCurrentDisplayMode(0, &dm) < 0) {