Skip to content

Commit 4d4fbe0

Browse files
committed
make sure the index is valid on start
1 parent d209743 commit 4d4fbe0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/CaDoodleFile.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ public void initialize() {
153153

154154
}
155155
int indexStarting = getCurrentIndex();
156-
setCurrentIndex(0);
156+
if(indexStarting==0) {
157+
indexStarting=opperations.size();
158+
}
159+
this.currentIndex=0;
157160
setPercentInitialized(0);
158161
opperations = opperations.stream().filter(Objects::nonNull).collect(Collectors.toCollection(ArrayList::new));
159162
if (indexStarting > opperations.size())
@@ -1073,7 +1076,8 @@ public int getCurrentIndex() {
10731076
}
10741077

10751078
public void setCurrentIndex(int currentIndex) {
1076-
// new Exception("Current Index set to " + currentIndex).printStackTrace();
1079+
// if(currentIndex==0)
1080+
// new Exception("Current Index set to " + currentIndex).printStackTrace();
10771081
if ((currentIndex - 1) >= getOpperations().size())
10781082
throw new RuntimeException("Fail! Can not set an index greater than the availible operations");
10791083
this.currentIndex = currentIndex;

0 commit comments

Comments
 (0)