Skip to content

Commit 5dd60e5

Browse files
authored
Avoid NPE by defaulting to enum name when no language node available in EnumUtil's toString. (#6375)
1 parent 555c76b commit 5dd60e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/ch/njol/skript/util/EnumUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public E parse(String input) {
107107
* @return A string representation of the enumerator.
108108
*/
109109
public String toString(E enumerator, int flags) {
110-
return names[enumerator.ordinal()];
110+
String s = names[enumerator.ordinal()];
111+
return s != null ? s : enumerator.name();
111112
}
112113

113114
/**

0 commit comments

Comments
 (0)