From 1566a9ea065ff92fbb211196cdbfcf51e6075ddb Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 21 Apr 2018 09:41:46 +0100 Subject: [PATCH] Only use the allowed joystick axis values (max is 2 - range check). --- src/system/input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/system/input.c b/src/system/input.c index bde6b14..327a16a 100644 --- a/src/system/input.c +++ b/src/system/input.c @@ -100,7 +100,10 @@ static void doButtonUp(SDL_JoyButtonEvent *event) static void doJoyAxis(SDL_JoyAxisEvent *event) { - app.joypadAxis[event->axis] = event->value; + if (event->axis < JOYPAD_AXIS_MAX) + { + app.joypadAxis[event->axis] = event->value; + } } void clearInput(void)