[Commits] SDL: cocoa: Don't crash on messagebox keypress without a success...

libsdl.org revision control commits-owner at libsdl.org
Tue May 2 18:46:31 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/b93491afe676
changeset: 10986:b93491afe676
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Tue May 02 21:46:28 2017 -0400
description:
cocoa: Don't crash on messagebox keypress without a successful SDL_Init().

diffstat:

 src/video/cocoa/SDL_cocoakeyboard.m |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r f6970c9a4434 -r b93491afe676 src/video/cocoa/SDL_cocoakeyboard.m
--- a/src/video/cocoa/SDL_cocoakeyboard.m	Tue May 02 11:31:14 2017 -0400
+++ b/src/video/cocoa/SDL_cocoakeyboard.m	Tue May 02 21:46:28 2017 -0400
@@ -646,7 +646,7 @@
 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 */
     }


More information about the commits mailing list