Skip to content

Commit

Permalink
Fixed crash when a controller is disconnected while rumble is pending
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 4, 2020
1 parent 281d05a commit 428cfdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/joystick/hidapi/SDL_hidapi_rumble.c
Expand Up @@ -76,7 +76,9 @@ static int SDL_HIDAPI_RumbleThread(void *data)

if (request) {
SDL_LockMutex(request->device->dev_lock);
hid_write(request->device->dev, request->data, request->size);
if (request->device->dev) {
hid_write( request->device->dev, request->data, request->size );
}
SDL_UnlockMutex(request->device->dev_lock);
(void)SDL_AtomicDecRef(&request->device->rumble_pending);
SDL_free(request);
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/hidapi/SDL_hidapi_switch.c
Expand Up @@ -477,7 +477,7 @@ static SDL_bool BTrySetupUSB(SDL_DriverSwitch_Context *ctx)
return SDL_FALSE;
}
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_HighSpeed, NULL, 0, SDL_TRUE)) {
/* The 8BitDo M30 doesn't respond to this command, but otherwise works correctly */
/* The 8BitDo M30 and SF30 Pro don't respond to this command, but otherwise work correctly */
/*return SDL_FALSE;*/
}
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) {
Expand Down

0 comments on commit 428cfdd

Please sign in to comment.