Browse Source

Fixes an NPE involving certain explosions.

Glitchfinder 12 years ago
parent
commit
f4cb83319e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/java/com/gmail/nossr50/listeners/EntityListener.java

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

@@ -229,10 +229,12 @@ public class EntityListener implements Listener {
     @EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
     public void onEnitityExplode(EntityExplodeEvent event) {
         Entity entity = event.getEntity();
+
+        if(entity == null) return;
         
         if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
 
-        if (event.getEntity() instanceof TNTPrimed) {
+        if (entity instanceof TNTPrimed) {
             int id = entity.getEntityId();
 
             if (plugin.tntIsTracked(id)) {