SDL: Fixed crash on Windows when a controller is connected (1d75b)

From 1d75b6bc592d1f48a7a997d9e2b5e85e1e94d361 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 1 May 2026 16:57:07 -0700
Subject: [PATCH] Fixed crash on Windows when a controller is connected

(cherry picked from commit 4a52a5ee04cd5cd3e2757aa165b4cb7b96857c92)
---
 src/joystick/hidapi/SDL_hidapi_xboxone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index c94b9b5a886d4..a3fa66e7c8ca3 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -376,7 +376,7 @@ static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, co
     }
 #endif
 #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
         return false;
     }