Fixed crash trying to get the GUID of an invalid joystick index
This commit is contained in:
parent
0e48e3563b
commit
6879bf00c4
1 changed files with 6 additions and 0 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue