[sim] GUI: fix memory corruption and incorrect POV count (#8853)

Fixes #8800 and fixes #8801.
This commit is contained in:
Gold856
2026-05-06 01:05:53 -04:00
committed by GitHub
parent d23c732d79
commit f97571fb1f

View File

@@ -203,7 +203,7 @@ class JoystickModel {
std::unique_ptr<wpi::glass::DoubleSource> axes[HAL_MAX_JOYSTICK_AXES];
// use pointer instead of unique_ptr to allow it to be passed directly
// to DrawLEDSources()
wpi::glass::BooleanSource* buttons[32];
wpi::glass::BooleanSource* buttons[64];
std::unique_ptr<wpi::glass::IntegerSource> povs[HAL_MAX_JOYSTICK_POVS];
private:
@@ -1477,7 +1477,7 @@ static void DisplayJoysticks() {
}
uint8_t povCount =
static_cast<uint8_t>(16 - std::countl_zero(joy.data.povs.available));
static_cast<uint8_t>(8 - std::countl_zero(joy.data.povs.available));
for (int j = 0; j < povCount; ++j) {
if (source && source->povs[j]) {