mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Check for negative button value and add missing newline.
Change-Id: I407ab2e0090c22b08503c6de0460d6c1291fa07f
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user