SDL: fix a bug if XINPUTGETBATTERYINFORMATION is nullptr

From cfbeb438c102c6fa8291a015af743d8b248e56ef Mon Sep 17 00:00:00 2001
From: Your Name <[EMAIL REDACTED]>
Date: Fri, 12 Aug 2022 21:05:37 +0800
Subject: [PATCH] fix a bug if XINPUTGETBATTERYINFORMATION is nullptr

---
 src/joystick/windows/SDL_rawinputjoystick.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index e6e9831ed8b..cff656b2669 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -338,7 +338,9 @@ RAWINPUT_UpdateXInput()
                     xinput_state[user_index].connected = SDL_FALSE;
                 }
                 xinput_state[user_index].battery.BatteryType = BATTERY_TYPE_UNKNOWN;
-                XINPUTGETBATTERYINFORMATION(user_index, BATTERY_DEVTYPE_GAMEPAD, &xinput_state[user_index].battery);
+                if (XINPUTGETBATTERYINFORMATION) {
+                    XINPUTGETBATTERYINFORMATION(user_index, BATTERY_DEVTYPE_GAMEPAD, &xinput_state[user_index].battery);
+                }
             }
         }
     }