Explorar o código

fix a bug if XINPUTGETBATTERYINFORMATION is nullptr

Your Name %!s(int64=3) %!d(string=hai) anos
pai
achega
cfbeb438c1
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/joystick/windows/SDL_rawinputjoystick.c

+ 3 - 1
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);
+                }
             }
         }
     }