diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index 1d797ad45..ea67d810c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -60,7 +60,8 @@ public class Piranha extends Mob { //this causes pirahna to move away when a door is closed on them. Dungeon.level.updateFieldOfView( this ); enemy = chooseEnemy(); - if (state == this.HUNTING && !(enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){ + if (state == this.HUNTING && + !(enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){ state = this.WANDERING; int oldPos = pos; int i = 0; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index 24f335d51..684596aee 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -499,7 +499,7 @@ public class Ghost extends NPC { @Override protected boolean getCloser( int target ) { combo = 0; //if he's moving, he isn't attacking, reset combo. - if (Level.adjacent(pos, enemy.pos)) { + if (enemy != null && Level.adjacent(pos, enemy.pos)) { return getFurther( target ); } else { return super.getCloser( target );