Fix crash in SDL_UpdateFullscreenMode calling SetWindowFullscreen with a null display

- This mirrors the check above for fullscreen=true in the unlikely case where there is no primary display detected
main
Sam Lantinga 2024-03-11 11:17:45 -07:00
parent ab5351f5d6
commit d4794cc714
1 changed files with 4 additions and 1 deletions

View File

@ -1765,7 +1765,10 @@ int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen, SDL_bool c
if (commit) {
int ret = 0;
if (_this->SetWindowFullscreen) {
ret = _this->SetWindowFullscreen(_this, window, display ? display : SDL_GetVideoDisplayForFullscreenWindow(window), SDL_FALSE);
SDL_VideoDisplay *full_screen_display = display ? display : SDL_GetVideoDisplayForFullscreenWindow(window);
if (full_screen_display) {
ret = _this->SetWindowFullscreen(_this, window, full_screen_display, SDL_FALSE);
}
} else {
resized = SDL_TRUE;
}