Fixed crash when tablet isn't detected properly
authorSam Lantinga <slouken@libsdl.org>
Tue, 26 Aug 2008 07:34:23 +0000
changeset 272776c2fc9696ea
parent 2726 f23ebf1ddac4
child 2728 2768bd7281e0
Fixed crash when tablet isn't detected properly
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
     1.1 --- a/src/events/SDL_mouse.c	Tue Aug 26 06:03:48 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Tue Aug 26 07:34:23 2008 +0000
     1.3 @@ -374,6 +374,11 @@
     1.4      int index = SDL_GetMouseIndexId(id);
     1.5      SDL_Mouse *mouse = SDL_GetMouse(index);
     1.6      int posted = 0;
     1.7 +
     1.8 +    if (!mouse) {
     1.9 +        return 0;
    1.10 +    }
    1.11 +
    1.12      last_x = x;
    1.13      last_y = y;
    1.14      if (SDL_ProcessEvents[type] == SDL_ENABLE) {
     2.1 --- a/src/events/SDL_mouse_c.h	Tue Aug 26 06:03:48 2008 +0000
     2.2 +++ b/src/events/SDL_mouse_c.h	Tue Aug 26 07:34:23 2008 +0000
     2.3 @@ -112,15 +112,18 @@
     2.4  /* Set the mouse focus window */
     2.5  extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
     2.6  
     2.7 -/* Send a mouse motion event for a mouse at an index */
     2.8 +/* Send a mouse motion event for a mouse */
     2.9  extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
    2.10  
    2.11 -/* Send a mouse button event for a mouse at an index */
    2.12 +/* Send a mouse button event for a mouse */
    2.13  extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
    2.14  
    2.15 -/* Send a mouse wheel event for a mouse at an index */
    2.16 +/* Send a mouse wheel event for a mouse */
    2.17  extern int SDL_SendMouseWheel(int id, int x, int y);
    2.18  
    2.19 +/* Send a proximity event for a mouse */
    2.20 +extern int SDL_SendProximity(int id, int x, int y, int type);
    2.21 +
    2.22  /* Shutdown the mouse subsystem */
    2.23  extern void SDL_MouseQuit(void);
    2.24