make so does not crash
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Joystick.java
index fab679234f9c1486cd4a427da34aab418a786bd2..7eac768cb0554bce4dcafdb9386bd2794898b7c6 100644 (file)
@@ -13,7 +13,9 @@ public class Joystick extends edu.wpi.first.wpilibj.Joystick {
     public Joystick(int port) {
         super(port);
 
-        IntStream.rangeClosed(1, 12).forEach((b) -> {
+        buttons = new HashMap<Integer, JoystickButton>();
+
+        IntStream.rangeClosed(1, getButtonCount()).forEach((b) -> {
             buttons.put(b, new JoystickButton(this, b));
         });
     }