Преглед на файлове

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();