From b29a4bebf29da02534747aec38dbe7cdb8734f9e Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 13 Dec 2014 02:37:35 -0800 Subject: [PATCH] Check for negative button value and add missing newline. Change-Id: I407ab2e0090c22b08503c6de0460d6c1291fa07f --- .../src/main/java/edu/wpi/first/wpilibj/DriverStation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DriverStation.java b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DriverStation.java index 787066cfa9..c81f73a3e5 100644 --- a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DriverStation.java +++ b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DriverStation.java @@ -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;