From d726efb948a505ffb17ad4b030649d7904b6e334 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 14 Dec 2019 12:17:48 -0500 Subject: [PATCH] v0.8.0: fixed rare crash errors with spinners and blast wave effects --- .../shatteredpixeldungeon/actors/mobs/Spinner.java | 7 ++++++- .../shatteredpixeldungeon/items/wands/WandOfBlastWave.java | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java index f2de46b5c..9c6419853 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java @@ -158,7 +158,12 @@ public class Spinner extends Mob { break; } } - + + //in case target is at the edge of the map and there are no more cells in the path + if (b.path.size() <= collisionIndex){ + return -1; + } + int webPos = b.path.get( collisionIndex+1 ); if (Dungeon.level.passable[webPos]){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 039f60890..85f2aee05 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -135,6 +135,8 @@ public class WandOfBlastWave extends DamageWand { collided = true; } + if (dist < 0) return; + final int newPos = trajectory.path.get(dist); if (newPos == ch.pos) return;