瀏覽代碼

Fixed crash on Windows when a controller is connected

(cherry picked from commit 4a52a5ee04cd5cd3e2757aa165b4cb7b96857c92)
Sam Lantinga 1 周之前
父節點
當前提交
1d75b6bc59
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/joystick/hidapi/SDL_hidapi_xboxone.c

+ 1 - 1
src/joystick/hidapi/SDL_hidapi_xboxone.c

@@ -376,7 +376,7 @@ static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, co
     }
     }
 #endif
 #endif
 #ifdef SDL_PLATFORM_WIN32
 #ifdef SDL_PLATFORM_WIN32
-    if (SDL_strncmp(device->path, "\\\\?\\HID#", 8) == 0) {
+    if (device && SDL_strncmp(device->path, "\\\\?\\HID#", 8) == 0) {
         // Windows provides a fake HID endpoint for XGIP controllers, don't use this
         // Windows provides a fake HID endpoint for XGIP controllers, don't use this
         return false;
         return false;
     }
     }