Преглед изворни кода

Fixed possible NPE when a projectile doesn't have a shooter

bm01 пре 13 година
родитељ
комит
a1296596fa
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/main/java/com/gmail/nossr50/listeners/EntityListener.java

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

@@ -64,6 +64,11 @@ public class EntityListener implements Listener {
 
         if (attacker instanceof Projectile) {
             attacker = ((Projectile) attacker).getShooter();
+
+            //There is no shooter when a projectile is thrown by a dispenser
+            if (attacker == null) {
+                return;
+            }
         }
         else if (attacker instanceof Tameable) {
             AnimalTamer animalTamer = ((Tameable) attacker).getOwner();