diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0ed0c58ea..57b579b37 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1591,8 +1591,13 @@ static void I_FillScreenResolutionsList(void) int count = 0; char desired_resolution[256]; + currentDisplayIndex = SDL_GetWindowDisplayIndex(window); + + // No valid index if (currentDisplayIndex < 0) - currentDisplayIndex = SDL_GetWindowDisplayIndex(window); + { + return; + } // didnt change screen, no need to redo the list if (currentDisplayIndex == oldDisplayIndex) @@ -1602,12 +1607,6 @@ static void I_FillScreenResolutionsList(void) oldDisplayIndex = currentDisplayIndex; - // No valid index - if (currentDisplayIndex < 0) - { - return; - } - // Don't call SDL_ListModes if SDL has not been initialized count = SDL_GetNumDisplayModes(currentDisplayIndex);