diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 690e8d152..2b86bffc4 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -727,7 +727,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.fuzz, absinfo.flat); #endif /* DEBUG_INPUT_EVENTS */ - joystick->hwdata->hats_indices[joystick->nhats++] = hat_index; + joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; } } if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) {