From d211da75ac635641c7872af12d460cb25ad5f17b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 25 Feb 2024 13:38:47 -0800 Subject: [PATCH] Fixed crash if app delegate method is called when SDL isn't initialized --- src/video/cocoa/SDL_cocoaevents.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index daaa0ba33..81f086cea 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -284,7 +284,10 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) - (void)screenParametersChanged:(NSNotification *)aNotification { - Cocoa_UpdateDisplays(SDL_GetVideoDevice()); + SDL_VideoDevice *device = SDL_GetVideoDevice(); + if (device) { + Cocoa_UpdateDisplays(device); + } } - (void)localeDidChange:(NSNotification *)notification