Skip to content

Commit

Permalink
Fixed mistake in reactor code parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
MauveCloud committed Mar 19, 2019
1 parent b0e0a8f commit 037f003
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Ic2ExpReactorPlanner/Reactor.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,18 @@ public void setCode(final String code) {
ids[row][col] = Integer.parseInt(code.substring(pos, pos + 2), 16);
pos += 2;
int paramNum = 0;
if (pos < code.length() && code.charAt(pos) == '(') {
if (pos < code.length() + 1 && code.charAt(pos) == '(') {
paramTypes[row][col][paramNum] = code.charAt(pos + 1);
int tempPos = pos + 2;
StringBuilder param = new StringBuilder(10);
while (code.charAt(tempPos) != ')') {
while (tempPos < code.length() && code.charAt(tempPos) != ')') {
if (code.charAt(tempPos) == ',') {
params[row][col][paramNum] = Integer.parseInt(param.toString(), 36);
paramNum++;
if (tempPos < code.length() + 1) {
tempPos++;
paramTypes[row][col][paramNum] = code.charAt(tempPos);
}
param.setLength(0);
} else {
param.append(code.charAt(tempPos));
Expand Down

0 comments on commit 037f003

Please sign in to comment.