Commit e32ac382 authored by Thomas Schwery's avatar Thomas Schwery
Browse files

Fix NullPointer on invalid settings

Settings having only a single Type caused a NullPointer when
printing the allowed types.

Improves #818
parent ee4408af
...@@ -1199,9 +1199,14 @@ public enum Setting { ...@@ -1199,9 +1199,14 @@ public enum Setting {
return; return;
} }
StringBuilder shouldBe = new StringBuilder(types[0].getSimpleName()); StringBuilder shouldBe;
for (int i = 1; i < types.length; i++) { if (type != null) {
shouldBe.append(" | ").append(types[i].getSimpleName()); shouldBe = new StringBuilder(type.getSimpleName());
} else {
shouldBe = new StringBuilder(types[0].getSimpleName());
for (int i = 1; i < types.length; i++) {
shouldBe.append(" | ").append(types[i].getSimpleName());
}
} }
String errorMsg = String.format("'%s' value is of incorrect type, is %s, should be %s", String errorMsg = String.format("'%s' value is of incorrect type, is %s, should be %s",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment