Skip to content

Commit

Permalink
Fixed crash unplugging a HIDAPI controller
Browse files Browse the repository at this point in the history
(cherry picked from commit 5f07347)
  • Loading branch information
slouken committed Mar 4, 2025
1 parent de11dd3 commit 5c0c5d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/joystick/hidapi/SDL_hidapijoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,12 +1135,13 @@ static void HIDAPI_UpdateDeviceList(void)
goto check_removed;
} else {
HIDAPI_DelDevice(device);
device = NULL;

// Update the device list again in case this device comes back
SDL_HIDAPI_change_count = 0;
}
}
if (device->broken && device->parent) {
if (device && device->broken && device->parent) {
HIDAPI_DelDevice(device->parent);

// We deleted a different device here, restart the loop
Expand Down

0 comments on commit 5c0c5d2

Please sign in to comment.