mirror of https://github.com/encounter/SDL.git
Fixed crash if the GameCube controller hasn't been opened yet
This commit is contained in:
parent
091a4649e8
commit
2cc70ca39e
|
@ -253,6 +253,10 @@ HIDAPI_DriverGameCube_HandleJoystickPacket(SDL_HIDAPI_Device *device, SDL_Driver
|
|||
}
|
||||
|
||||
joystick = SDL_JoystickFromInstanceID(ctx->joysticks[i]);
|
||||
if (!joystick) {
|
||||
/* Hasn't been opened yet, skip */
|
||||
return;
|
||||
}
|
||||
|
||||
#define READ_BUTTON(off, flag, button) \
|
||||
SDL_PrivateJoystickButton( \
|
||||
|
|
Loading…
Reference in New Issue