Skip to content

Commit

Permalink
fix a bug if XINPUTGETBATTERYINFORMATION is nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and icculus committed Aug 12, 2022
1 parent f42291c commit cfbeb43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/joystick/windows/SDL_rawinputjoystick.c
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit cfbeb43

Please sign in to comment.