Skip to content
Snippets Groups Projects
Commit b5e534a2 authored by Fabienne Scholz's avatar Fabienne Scholz Committed by Darius Vollmer
Browse files

fix!(State): added handler for out of length

parent 2ced1826
Branches feature/layout
No related tags found
2 merge requests!6Merge: dev->main,!5Merge: Feature/layout->dev
......@@ -48,8 +48,13 @@ public class State {
public double[] getOperand() {
double[] operands = new double[2];
operands[0] = this.values.get(this.values.size()-1);
operands[1] = this.values.get(this.values.size()-2);
if (this.values.size() < 2) {
operands[0] = this.values.get(this.values.size()-1);
operands[1] = 0;
} else {
operands[0] = this.values.get(this.values.size()-1);
operands[1] = this.values.get(this.values.size()-2);
}
return operands;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment