Check for negative button value and add missing newline.

Change-Id: I407ab2e0090c22b08503c6de0460d6c1291fa07f
This commit is contained in:
Peter Johnson
2014-12-13 02:37:35 -08:00
parent ac60198842
commit b29a4bebf2

View File

@@ -299,9 +299,9 @@ public class DriverStation implements RobotState.Interface {
reportJoystickUnpluggedError("WARNING: Joystick Button " + button + " on port " + stick + " not available, check if controller is plugged in\n");
return false;
}
if(button == 0)
if(button <= 0)
{
reportJoystickUnpluggedError("ERROR: Button indexes begin at 1 in WPILib for C++ and Java");
reportJoystickUnpluggedError("ERROR: Button indexes begin at 1 in WPILib for C++ and Java\n");
return false;
}
return ((0x1 << (button - 1)) & m_joystickButtons[stick].buttons) != 0;