Fixed crash unplugging a HIDAPI controller

This commit is contained in:
Sam Lantinga 2025-03-04 11:41:25 -08:00
parent 82552e5b7c
commit 5f07347e4f
1 changed files with 2 additions and 1 deletions

View File

@ -1135,12 +1135,13 @@ check_removed:
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