Skip to content

Commit da86b66

Browse files
weirddan455slouken
authored andcommitted
Add an early check for SDL 3 window creation error
This makes sure to preserve error messages set by SDL 3
1 parent 0d1ebe0 commit da86b66

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/sdl2_compat.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9213,14 +9213,16 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
92139213
}
92149214
}
92159215

9216-
if (exclusive_fullscreen) {
9217-
ApplyFullscreenMode(window);
9218-
SDL3_SetWindowFullscreen(window, true);
9219-
}
9220-
if (manually_show) {
9221-
SDL3_ShowWindow(window);
9216+
if (window) {
9217+
if (exclusive_fullscreen) {
9218+
ApplyFullscreenMode(window);
9219+
SDL3_SetWindowFullscreen(window, true);
9220+
}
9221+
if (manually_show) {
9222+
SDL3_ShowWindow(window);
9223+
}
9224+
FinishWindowCreation(window);
92229225
}
9223-
FinishWindowCreation(window);
92249226

92259227
return window;
92269228
}
@@ -9285,7 +9287,9 @@ SDL_CreateWindowFrom(const void *data)
92859287
window = SDL3_CreateWindowWithProperties(props);
92869288
SDL3_DestroyProperties(props);
92879289

9288-
FinishWindowCreation(window);
9290+
if (window) {
9291+
FinishWindowCreation(window);
9292+
}
92899293

92909294
return window;
92919295
}

0 commit comments

Comments
 (0)