Check for NULL joystick in SDL_JoystickGetGUID()

This commit is contained in:
Sam Lantinga 2013-10-06 13:49:23 -07:00
parent 90a219a375
commit 8f46bcfd6d
1 changed files with 5 additions and 0 deletions

View File

@ -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 );
}