Check for NULL joystick in SDL_JoystickGetGUID()
authorSam Lantinga <slouken@libsdl.org>
Sun, 06 Oct 2013 13:49:23 -0700
changeset 7789 a18c12b02b69
parent 7788 25355ecf10aa
child 7790 8136ce6b3950
Check for NULL joystick in SDL_JoystickGetGUID()
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 13:49:23 2013 -0700
@@ -763,6 +763,11 @@
 /* return the guid for this opened device */
 SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
 {
+    if (!SDL_PrivateJoystickValid(joystick)) {
+        SDL_JoystickGUID emptyGUID;
+        SDL_zero( emptyGUID );
+        return emptyGUID;
+    }
     return SDL_SYS_JoystickGetGUID( joystick );
 }