From 8f46bcfd6dfeea0fb476499d24758db5dced6379 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Oct 2013 13:49:23 -0700 Subject: [PATCH] Check for NULL joystick in SDL_JoystickGetGUID() --- src/joystick/SDL_joystick.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 805eb5e2f..175aaef5a 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -763,6 +763,11 @@ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) /* 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 ); }