From 1413848f4188412ee26d32e35d1b1b6d63f54f52 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 20 Nov 2024 13:27:43 -0800
Subject: [PATCH] Fixed crash if a window ends up without a display
---
src/video/SDL_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 2b1ceb97d6bce..67a91aec09407 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -2413,7 +2413,7 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
if (flags & SDL_WINDOW_FULLSCREEN || IsFullscreenOnly(_this)) {
SDL_Rect bounds;
- SDL_GetDisplayBounds(display->id, &bounds);
+ SDL_GetDisplayBounds(display ? display->id : SDL_GetPrimaryDisplay(), &bounds);
window->x = bounds.x;
window->y = bounds.y;
window->w = bounds.w;