From 20d0a1a3d1a102f64ae054e0f718aba02e21bd34 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 4 Sep 2024 16:29:22 -0700
Subject: [PATCH] Added a defensive check against XINPUTGETCAPABILITIES being
NULL
This should never happen, but it does, possibly due to a data segment overwrite elsewhere.
---
src/joystick/windows/SDL_xinputjoystick.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c
index 992be0816a5ac..490edf45e530f 100644
--- a/src/joystick/windows/SDL_xinputjoystick.c
+++ b/src/joystick/windows/SDL_xinputjoystick.c
@@ -218,7 +218,7 @@ void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
{
int iuserid;
- if (!s_bXInputEnabled) {
+ if (!s_bXInputEnabled || !XINPUTGETCAPABILITIES) {
return;
}