From fb485986eb64e01e6d60398ee1024d118bd3a698 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 30 Sep 2018 11:26:41 -0300 Subject: [PATCH] macOS: Fix a crash when the video subsystem quits, if SDL_MAC_NO_SANDBOX was defined when SDL was compiled. --- src/video/cocoa/SDL_cocoamousetap.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m index 05a7d77d8afbf..aa4f152e6acab 100644 --- a/src/video/cocoa/SDL_cocoamousetap.m +++ b/src/video/cocoa/SDL_cocoamousetap.m @@ -237,6 +237,13 @@ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; int status; + if (tapdata == NULL) { + /* event tap was already cleaned up (possibly due to CGEventTapCreate + * returning null.) + */ + return; + } + /* Ensure that the runloop has been started first. * TODO: Move this to InitMouseEventTap, check for error conditions that can * happen in Cocoa_MouseTapThread, and fall back to the non-EventTap way of