cocoa: Don't crash on messagebox keypress without a successful SDL_Init().

This commit is contained in:
Ryan C. Gordon 2017-05-02 21:46:28 -04:00
parent d00dfc434e
commit ce2998b8b9

View File

@ -646,7 +646,7 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
void void
Cocoa_HandleKeyEvent(_THIS, NSEvent *event) Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL;
if (!data) { if (!data) {
return; /* can happen when returning from fullscreen Space on shutdown */ return; /* can happen when returning from fullscreen Space on shutdown */
} }