Skip to content

Commit fa4a706

Browse files
committed
Fix AutonomousBase to properly handle null modules
1 parent 0727b5f commit fa4a706

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Autonomous/AutonomousBase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
44
import com.qualcomm.robotcore.hardware.HardwareMap;
55
import org.firstinspires.ftc.teamcode.FTC_Library.Autonomous.Modules.Module;
6+
import org.firstinspires.ftc.teamcode.FTC_Library.Autonomous.Modules.Wait;
67
import org.firstinspires.ftc.teamcode.FTC_Library.Robot.RobotBase;
78

89
/**
@@ -70,6 +71,10 @@ public void loop() {
7071
}
7172

7273
current = steps[currentStep][currentOption];//get new current module
74+
75+
if (current == null) {//redefine null modules as a 1 milli wait
76+
current = steps[currentStep][currentOption] = new Wait().setWaitTime(1);
77+
}
7378
current.init(robot, selectedOption, telemetry);//initialize it with the passed through option so it can be passed through multiple times
7479
current.start();//start current module
7580
} else {

0 commit comments

Comments
 (0)