Browse Source

Potion NPE fix

nossr50 5 years ago
parent
commit
ded7fd5bdf
2 changed files with 6 additions and 0 deletions
  1. 3 0
      Changelog.txt
  2. 3 0
      src/main/java/com/gmail/nossr50/listeners/EntityListener.java

+ 3 - 0
Changelog.txt

@@ -1,3 +1,6 @@
+Version 2.1.134
+    Fixed a NPE that could happen with thrown potions
+
 Version 2.1.133
     A fix for an 'array out of bounds' error related to players clicking outside the inventory windows has been fixed
     French locale has been updated (thanks Elikill58)

+ 3 - 0
src/main/java/com/gmail/nossr50/listeners/EntityListener.java

@@ -1061,6 +1061,9 @@ public class EntityListener implements Listener {
         if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
             return;
 
+        if(event.getPotion().getItem().getItemMeta() == null)
+            return;
+
         for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
             if (!effect.getType().equals(PotionEffectType.SATURATION)) {
                 return;