From 9093385de38849a176a01f28ceae2c94f142d10d Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 13 Dec 2019 14:30:37 +0000 Subject: [PATCH] Fix NPE in Permissible#recalculatePermissions --- .../luckperms/bukkit/inject/permissible/LPPermissible.java | 4 +++- .../luckperms/nukkit/inject/permissible/LPPermissible.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java index 8e75a0e96..8cee98dee 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java @@ -308,7 +308,9 @@ public class LPPermissible extends PermissibleBase { // because we encapsulate op status within QueryOptions, we need to invalidate // the contextmanager cache when op status changes. // (#invalidate is a fast call) - this.queryOptionsSupplier.invalidate(); + if (this.queryOptionsSupplier != null) { // this method is called by the super class constructor, before this class has fully initialised + this.queryOptionsSupplier.invalidate(); + } // but we don't need to do anything else in this method, unlike the CB impl. } diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LPPermissible.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LPPermissible.java index 5a34d18e4..89284e2e8 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LPPermissible.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LPPermissible.java @@ -294,7 +294,9 @@ public class LPPermissible extends PermissibleBase { // because we encapsulate op status within QueryOptions, we need to invalidate // the contextmanager cache when op status changes. // (#invalidate is a fast call) - this.queryOptionsSupplier.invalidate(); + if (this.queryOptionsSupplier != null) { // this method is called by the super class constructor, before this class has fully initialised + this.queryOptionsSupplier.invalidate(); + } // but we don't need to do anything else in this method, unlike the CB impl. }