mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-11 00:55:36 +00:00
cocoa: Don't crash if moving a message box created before SDL_Init.
Fixes #5928.
This commit is contained in:
parent
f789bc7d5f
commit
218c3dbb34
|
@ -400,6 +400,12 @@ Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event)
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
NSWindow *nswindow = [event window];
|
NSWindow *nswindow = [event window];
|
||||||
|
|
||||||
|
/* You might land in this function before SDL_Init if showing a message box.
|
||||||
|
Don't derefence a NULL pointer if that happens. */
|
||||||
|
if (_this == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (window = _this->windows; window; window = window->next) {
|
for (window = _this->windows; window; window = window->next) {
|
||||||
SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
|
SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
|
||||||
if (data && data.nswindow == nswindow) {
|
if (data && data.nswindow == nswindow) {
|
||||||
|
|
Loading…
Reference in a new issue