From ea8596d36b9ebfdb122d1f7ead6b20e464a2b548 Mon Sep 17 00:00:00 2001 From: Sparky200 Date: Mon, 16 Sep 2024 20:31:15 -0500 Subject: [PATCH] Fix NPE caused by unregistered ClassInfo --- src/main/java/ch/njol/skript/lang/SkriptParser.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/njol/skript/lang/SkriptParser.java b/src/main/java/ch/njol/skript/lang/SkriptParser.java index c8d9b551a69..cefa92b2549 100644 --- a/src/main/java/ch/njol/skript/lang/SkriptParser.java +++ b/src/main/java/ch/njol/skript/lang/SkriptParser.java @@ -1181,7 +1181,15 @@ public static String notOfType(Class... types) { } Class c = types[i]; assert c != null; - message.append(Classes.getSuperClassInfo(c).getName().withIndefiniteArticle()); + ClassInfo classInfo = Classes.getSuperClassInfo(c); + // if there's a registered class info, + if (classInfo != null) { + // use the article, + message.append(classInfo.getName().withIndefiniteArticle()); + } else { + // otherwise fallback to class name + message.append(c.getName()); + } } return message.toString(); }