Fix gamepad disconnect on unrecognized HID device (#13321)

== DETAILS
So, the reason the gamepad was getting deregistered was
because adapter free code wasn't properly handling null-interface
adapters, causing the gamepad to match erroneously and get
deregistered.

This doesn't fix the weird "Generic SNES USB" detection issue,
but it should make it non-fatal.

Co-authored-by: Nathan Strong <nstrong@tripwire.com>
This commit is contained in:
gblues 2021-12-04 03:43:58 -08:00 committed by GitHub
parent b6695d8921
commit bf9706395d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -469,7 +469,10 @@ static void synchronized_process_adapters(wiiu_hid_t *hid)
else
prev->next = adapter->next;
pad_connection_pad_deregister(joypad_state.pads, adapter->pad_driver, adapter->pad_driver_data);
if(adapter->pad_driver && adapter->pad_driver_data)
{
pad_connection_pad_deregister(joypad_state.pads, adapter->pad_driver, adapter->pad_driver_data);
}
/* adapter is no longer valid after this point */
delete_adapter(adapter);
/* signal not to update prev ptr since adapter is now invalid */