Skip to content

Commit b303261

Browse files
committed
Generate zero vector again when given an empty array. (CMDHELPER-3081)
1 parent 7b64c05 commit b303261

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/main/java/com/laytonsmith/core/ObjectGenerator.java

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -871,29 +871,26 @@ public Vector3D vector(Vector3D v, Construct c, Target t) {
871871
x = Static.getNumber(va.get(0, t), t);
872872
y = Static.getNumber(va.get(1, t), t);
873873
z = Static.getNumber(va.get(2, t), t);
874-
} else
875-
if(va.size() == 2) { // 2nd dimension vector
874+
} else if(va.size() == 2){ // 2nd dimension vector
876875
x = Static.getNumber(va.get(0, t), t);
877876
y = Static.getNumber(va.get(1, t), t);
878-
z = 0;
879-
} else {
880-
throw new ConfigRuntimeException("Expecting a Vector array, but the array did not meet the format specifications", ExceptionType.FormatException, t);
877+
} else if(va.size() == 1){
878+
x = Static.getNumber(va.get(0, t), t);
879+
}
880+
} else {
881+
if(va.containsKey("x")){
882+
x = Static.getNumber(va.get("x", t), t);
883+
}
884+
if(va.containsKey("y")){
885+
y = Static.getNumber(va.get("y", t), t);
886+
}
887+
if(va.containsKey("z")){
888+
z = Static.getNumber(va.get("z", t), t);
881889
}
882-
}
883-
884-
if(va.containsKey("x")) {
885-
x = Static.getNumber(va.get("x", t), t);
886-
}
887-
if(va.containsKey("y")) {
888-
y = Static.getNumber(va.get("y", t), t);
889-
}
890-
if(va.containsKey("z")) {
891-
z = Static.getNumber(va.get("z", t), t);
892890
}
893891

894892
return new Vector3D(x, y, z);
895-
} else
896-
if(c instanceof CNull) {
893+
} else if(c instanceof CNull) {
897894
// fulfilling the todo?
898895
return v;
899896
} else {

0 commit comments

Comments
 (0)