mirror of https://github.com/encounter/SDL.git
Fixed crash if Joy-Cons are disabled while a combined Joy-Cons controller is open
This commit is contained in:
parent
bcdef4aaf9
commit
8ab9dc8b2b
|
@ -317,6 +317,17 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device)
|
||||||
} else {
|
} else {
|
||||||
enabled = device->driver->enabled;
|
enabled = device->driver->enabled;
|
||||||
}
|
}
|
||||||
|
if (device->children) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < device->num_children; ++i) {
|
||||||
|
SDL_HIDAPI_Device *child = device->children[i];
|
||||||
|
if (!child->driver || !child->driver->enabled) {
|
||||||
|
enabled = SDL_FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
HIDAPI_CleanupDeviceDriver(device);
|
HIDAPI_CleanupDeviceDriver(device);
|
||||||
}
|
}
|
||||||
|
@ -813,7 +824,7 @@ check_removed:
|
||||||
SDL_HIDAPI_Device *next = device->next;
|
SDL_HIDAPI_Device *next = device->next;
|
||||||
|
|
||||||
if (!device->seen ||
|
if (!device->seen ||
|
||||||
(device->driver && device->num_joysticks == 0 && !device->dev)) {
|
((device->driver || device->children) && device->num_joysticks == 0 && !device->dev)) {
|
||||||
if (device->parent) {
|
if (device->parent) {
|
||||||
/* When a child device goes away, so does the parent */
|
/* When a child device goes away, so does the parent */
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in New Issue