Browse Source

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

bm01 13 years ago
parent
commit
a1296596fa
1 changed files with 5 additions and 0 deletions
  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();