Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed crash trying to get the GUID of an invalid joystick index

  • Loading branch information
slouken committed Jun 7, 2013
1 parent 68ff282 commit c6b03094a34836211d448319ef7556d6cfae4b80
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/joystick/SDL_joystick.c
@@ -729,6 +729,12 @@ SDL_PrivateJoystickNeedsPolling()
/* return the guid for this index */
SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index)
{
if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
SDL_JoystickGUID emptyGUID;
SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
SDL_zero( emptyGUID );
return emptyGUID;
}
return SDL_SYS_JoystickGetDeviceGUID( device_index );
}

0 comments on commit c6b0309

Please sign in to comment.