make so does not crash
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Robot.java
index c7ef783478c8307e5b01d3e5ae714dd192e9b887..84fd2f9faa8afa3fc1726a564d18c5abcae4433e 100644 (file)
@@ -29,8 +29,6 @@ public class Robot extends IterativeRobot {
     private Command autonomousCommand;
 
     public void robotInit() {
-               oi = new OI();
-
                drivetrain = new Drivetrain();
                arm        = new Arm();
                claw       = new Claw();
@@ -39,6 +37,8 @@ public class Robot extends IterativeRobot {
 
                autonData = new AutonData();
 
+               oi = new OI();
+
                chooseAuto();
     }
 
@@ -62,7 +62,8 @@ public class Robot extends IterativeRobot {
     public void teleopInit() {
         schedule(new TurnOnCompressor());
 
-        autonomousCommand.cancel();
+        if (autonomousCommand != null)
+            autonomousCommand.cancel();
     }
 
     public void teleopPeriodic() {