From b2cd7e0bdab6bd8da60755cb5bd71a6fa7d8700a Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 21 Nov 2022 15:15:19 +0100 Subject: [PATCH] Fix NPE in BukkitEvent --- .../main/java/fr/pandacube/lib/paper/util/BukkitEvent.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java index 9cd15d0..c84cfeb 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java @@ -58,7 +58,10 @@ public class BukkitEvent { // method retrieved from OB.plugin.SimplePluginManager#getEventListeners public static HandlerList getHandlerList(Class type) { try { - return (HandlerList) Reflect.ofClass(getRegistrationClass(type)).method("getHandlerList").invokeStatic(); + Class actualClass = getRegistrationClass(type); + if (actualClass == null) + return null; + return (HandlerList) Reflect.ofClass(actualClass).method("getHandlerList").invokeStatic(); } catch (ReflectiveOperationException e) { return null;