Skip to content

Commit

Permalink
Avoid impossible NPE.
Browse files Browse the repository at this point in the history
Please, before complaining about this commit, realize that logic does
not apply to arrow entities when Sentry is involved.
  • Loading branch information
mcmonkey4eva committed Sep 28, 2013
1 parent b739009 commit ee7bc96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -551,7 +551,7 @@ public boolean isGeneric() {

public dLocation getLocation() {

if (!isGeneric()) {
if (isUnique() && entity != null) {
return new dLocation(entity.getLocation());
}

Expand Down
Expand Up @@ -2322,6 +2322,9 @@ public void projectileHit(ProjectileHitEvent event) {

dEntity projectile = new dEntity(event.getEntity());

if (projectile.getLocation() == null)
return; // No, I can't explain how or why this would ever happen... nonetheless, it appears it does happen sometimes.

Block block = null;
BlockIterator bi = new BlockIterator(projectile.getLocation().getWorld(), projectile.getLocation().toVector(), projectile.getLocation().getDirection().normalize(), 0, 4);
while(bi.hasNext()) {
Expand Down

0 comments on commit ee7bc96

Please sign in to comment.