From 62c5aeffc87ed6d7757561c73161732464d4d3c9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 16 Nov 2017 12:30:10 -0500 Subject: [PATCH] v0.6.2d: fixed various crash bugs and added safety checks --- .../shatteredpixeldungeon/effects/SpellSprite.java | 6 ++++-- .../shatteredpixeldungeon/items/armor/MageArmor.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java index 06022d4f6..24bd75ae1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java @@ -80,8 +80,10 @@ public class SpellSprite extends Image { public void update() { super.update(); - x = target.sprite.center().x - SIZE / 2; - y = target.sprite.y - SIZE; + if (target.sprite != null) { + x = target.sprite.center().x - SIZE / 2; + y = target.sprite.y - SIZE; + } switch (phase) { case FADE_IN: diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java index 207fc452d..72aef6bbc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java @@ -41,7 +41,7 @@ public class MageArmor extends ClassArmor { @Override public void doSpecial() { - for (Mob mob : Dungeon.level.mobs) { + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) { if (Dungeon.level.heroFOV[mob.pos]) { Buff.affect( mob, Burning.class ).reignite( mob ); Buff.prolong( mob, Roots.class, 3 );