Fix NPE in BukkitEvent

This commit is contained in:
Marc Baloup 2022-11-21 15:15:19 +01:00
parent 616ae69d41
commit b2cd7e0bda
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -58,7 +58,10 @@ public class BukkitEvent {
// method retrieved from OB.plugin.SimplePluginManager#getEventListeners // method retrieved from OB.plugin.SimplePluginManager#getEventListeners
public static HandlerList getHandlerList(Class<? extends Event> type) { public static HandlerList getHandlerList(Class<? extends Event> type) {
try { try {
return (HandlerList) Reflect.ofClass(getRegistrationClass(type)).method("getHandlerList").invokeStatic(); Class<? extends Event> actualClass = getRegistrationClass(type);
if (actualClass == null)
return null;
return (HandlerList) Reflect.ofClass(actualClass).method("getHandlerList").invokeStatic();
} }
catch (ReflectiveOperationException e) { catch (ReflectiveOperationException e) {
return null; return null;