Dereferencing NULL pointers is bad mmkay

Noticed a public API function in the joystick code that doesn’t
validate the joystick pointer passed before dereferencing it.

Trivial patch follows.

Joseph

-------------- next part --------------
diff -r 25355ecf10aa src/joystick/SDL_joystick.c
— a/src/joystick/SDL_joystick.c Sat Oct 05 21:15:55 2013 -0700
+++ b/src/joystick/SDL_joystick.c Sun Oct 06 05:52:46 2013 -0700
@@ -763,6 +763,12 @@
/* return the guid for this opened device */
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
{

  • /* Make sure we’re dealing with an open joystick */
  • if (SDL_PrivateJoystickValid(joystick)) {
  •    SDL_JoystickGUID emptyGUID;
    
  •    SDL_zero( emptyGUID );
    
  •    return emptyGUID;
    
  • }
    return SDL_SYS_JoystickGetGUID( joystick );
    }