DriverStation: fix error checking for GetXXXAxis and GetXXXPov (#1469)

Fixes #1436
This commit is contained in:
Dustin Spicuzza
2018-12-07 01:31:14 -05:00
committed by Peter Johnson
parent dcbf02a1ec
commit b64dfacff3
2 changed files with 5 additions and 5 deletions

View File

@@ -420,7 +420,7 @@ public class DriverStation {
if (stick < 0 || stick >= kJoystickPorts) {
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
}
if (axis >= HAL.kMaxJoystickAxes) {
if (axis < 0 || axis >= HAL.kMaxJoystickAxes) {
throw new IllegalArgumentException("Joystick axis is out of range");
}
@@ -451,7 +451,7 @@ public class DriverStation {
if (stick < 0 || stick >= kJoystickPorts) {
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
}
if (pov >= HAL.kMaxJoystickPOVs) {
if (pov < 0 || pov >= HAL.kMaxJoystickPOVs) {
throw new IllegalArgumentException("Joystick POV is out of range");
}