diff --git a/interface/src/devices/Joystick.cpp b/interface/src/devices/Joystick.cpp index 25b8bc142d..8b225437c2 100644 --- a/interface/src/devices/Joystick.cpp +++ b/interface/src/devices/Joystick.cpp @@ -45,9 +45,14 @@ void Joystick::closeJoystick() { #ifdef HAVE_SDL2 void Joystick::handleAxisEvent(const SDL_ControllerAxisEvent& event) { + if (_axes.size() <= event.axis) { + _axes.resize(event.axis + 1); + } + float oldValue = _axes[event.axis]; float newValue = event.value / MAX_AXIS; _axes[event.axis] = newValue; + emit axisValueChanged(event.axis, newValue, oldValue); }