Check for NULL joystick in SDL_JoystickGetGUID()
authorSam Lantinga <slouken@libsdl.org>
Sun, 06 Oct 2013 13:49:23 -0700
changeset 7789a18c12b02b69
parent 7788 25355ecf10aa
child 7790 8136ce6b3950
Check for NULL joystick in SDL_JoystickGetGUID()
src/joystick/SDL_joystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Sat Oct 05 21:15:55 2013 -0700
     1.2 +++ b/src/joystick/SDL_joystick.c	Sun Oct 06 13:49:23 2013 -0700
     1.3 @@ -763,6 +763,11 @@
     1.4  /* return the guid for this opened device */
     1.5  SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
     1.6  {
     1.7 +    if (!SDL_PrivateJoystickValid(joystick)) {
     1.8 +        SDL_JoystickGUID emptyGUID;
     1.9 +        SDL_zero( emptyGUID );
    1.10 +        return emptyGUID;
    1.11 +    }
    1.12      return SDL_SYS_JoystickGetGUID( joystick );
    1.13  }
    1.14