Skip to content

Commit

Permalink
Fix NPE caused by unregistered ClassInfo (#7085)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparky200 authored Sep 17, 2024
1 parent 86742a9 commit 96dce83
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/ch/njol/skript/lang/SkriptParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 96dce83

Please sign in to comment.