Fixed crash if no window has keyboard focus
authorSam Lantinga <slouken@libsdl.org>
Fri, 06 Dec 2013 16:12:18 -0800
changeset 80542a38ef3eeabb
parent 8053 495f4a047be1
child 8055 3e2f230a6d62
Fixed crash if no window has keyboard focus
src/video/cocoa/SDL_cocoamousetap.m
     1.1 --- a/src/video/cocoa/SDL_cocoamousetap.m	Fri Dec 06 09:13:31 2013 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoamousetap.m	Fri Dec 06 16:12:18 2013 -0800
     1.3 @@ -63,7 +63,7 @@
     1.4      SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
     1.5      SDL_Mouse *mouse = SDL_GetMouse();
     1.6      SDL_Window *window = SDL_GetKeyboardFocus();
     1.7 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
     1.8 +    NSWindow *nswindow;
     1.9      NSRect windowRect;
    1.10      CGPoint eventLocation;
    1.11  
    1.12 @@ -93,6 +93,7 @@
    1.13      }
    1.14  
    1.15      /* This is the same coordinate system as Cocoa uses. */
    1.16 +    nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    1.17      eventLocation = CGEventGetUnflippedLocation(event);
    1.18      windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
    1.19