From ce2998b8b914ebfd42f6ff4a9b09f6f094ab40f0 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 2 May 2017 21:46:28 -0400 Subject: [PATCH] cocoa: Don't crash on messagebox keypress without a successful SDL_Init(). --- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index b641a4a76..c3509e6b5 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -646,7 +646,7 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ }