소스 검색

Fixed crash unplugging a HIDAPI controller

(cherry picked from commit 5f07347e4f4c1d9175cbd8fdcd7c662788c3910f)
Sam Lantinga 6 달 전
부모
커밋
5c0c5d2816
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/joystick/hidapi/SDL_hidapijoystick.c

+ 2 - 1
src/joystick/hidapi/SDL_hidapijoystick.c

@@ -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