Skip to content

Commit

Permalink
Condition SDL counts so we don't pass negative numbers to new
Browse files Browse the repository at this point in the history
Should address mavlink#4425
  • Loading branch information
NaterGator authored and dagar committed Jan 13, 2017
1 parent 0ccb1a2 commit 4a25648
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Joystick/JoystickSDL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ QMap<QString, Joystick*> JoystickSDL::discover(MultiVehicleManager* _multiVehicl
SDL_JoystickClose(sdlJoystick);

qCDebug(JoystickLog) << "\t" << name << "axes:" << axisCount << "buttons:" << buttonCount << "hats:" << hatCount << "isGC:" << isGameController;
ret[name] = new JoystickSDL(name, axisCount, buttonCount, hatCount, i, isGameController, _multiVehicleManager);
ret[name] = new JoystickSDL(name, qMax(0,axisCount), qMax(0,buttonCount), qMax(0,hatCount), i, isGameController, _multiVehicleManager);
} else {
qCDebug(JoystickLog) << "\tSkipping duplicate" << name;
}
Expand Down

0 comments on commit 4a25648

Please sign in to comment.