Skip to content

Commit

Permalink
Fixed a crash when unplugging a Steam Controller dongle
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 18, 2024
1 parent 70fe38b commit 184da78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/joystick/hidapi/SDL_hidapi_steam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,9 @@ static void ControllerDisconnected(SDL_HIDAPI_Device *device, SDL_Joystick **joy
{
SDL_DriverSteam_Context *ctx = (SDL_DriverSteam_Context *)device->context;

HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
if (device->joysticks) {
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
ctx->connected = false;
*joystick = NULL;
}
Expand Down

0 comments on commit 184da78

Please sign in to comment.