From ca02aa8a049e25d544321d293b0ca23dac350ef2 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 22:26:37 +0200 Subject: [PATCH] JoystickInput: fix potential init problem Don't remember the axis position before bindings are loaded --- src/Input/FGJoystickInput.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx index 3f490f5cb..0d0a86ce9 100644 --- a/src/Input/FGJoystickInput.cxx +++ b/src/Input/FGJoystickInput.cxx @@ -305,7 +305,9 @@ void FGJoystickInput::update( double dt ) // Do nothing if the axis position // is unchanged; only a change in // position fires the bindings. - if (fabs(axis_values[j] - a.last_value) > a.tolerance) { + // But only if there are bindings + if (fabs(axis_values[j] - a.last_value) > a.tolerance + && a.bindings[KEYMOD_NONE].size() > 0 ) { a.last_value = axis_values[j]; for (unsigned int k = 0; k < a.bindings[KEYMOD_NONE].size(); k++) a.bindings[KEYMOD_NONE][k]->fire(axis_values[j]);