Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash trying to get the GUID of an invalid joystick index
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 7, 2013
1 parent 68ff282 commit c6b0309
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/joystick/SDL_joystick.c
Expand Up @@ -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 );
}

Expand Down

0 comments on commit c6b0309

Please sign in to comment.