]> git.mxchange.org Git - flightgear.git/commitdiff
JoystickInput: fix potential init problem
authorTorsten Dreyer <Torsten@t3r.de>
Sun, 17 Jul 2011 20:26:37 +0000 (22:26 +0200)
committerTorsten Dreyer <Torsten@t3r.de>
Sun, 17 Jul 2011 20:26:37 +0000 (22:26 +0200)
Don't remember the axis position before bindings are loaded

src/Input/FGJoystickInput.cxx

index 3f490f5cbef9153afc9d5f1cc1018fcb3fa2062a..0d0a86ce97c0f49f4fff7cc294893f1e96dc49aa 100644 (file)
@@ -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]);