From 218e1216af4fd1bc31defed2c9baf5f115296406 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 28 Sep 2025 11:11:28 -0400 Subject: [PATCH] v3.2.5: added a few safety checks for various rare errors --- .../shatteredpixeldungeon/actors/hero/Hero.java | 2 +- .../shatteredpixeldungeon/actors/mobs/Mob.java | 2 +- .../shatteredpixeldungeon/scenes/GameScene.java | 11 ++++++----- .../shatteredpixeldungeon/ui/QuickSlotButton.java | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index aaacde2b9..935c563a3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -607,7 +607,7 @@ public class Hero extends Char { Combo.ParryTracker parry = buff(Combo.ParryTracker.class); if (parry != null){ parry.parried = true; - if (buff(Combo.class).getComboCount() < 9 || pointsInTalent(Talent.ENHANCED_COMBO) < 2){ + if (buff(Combo.class) == null || buff(Combo.class).getComboCount() < 9 || pointsInTalent(Talent.ENHANCED_COMBO) < 2){ parry.detach(); } return Messages.get(Monk.class, "parried"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index e280c9785..208e1e2f9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -502,7 +502,7 @@ public abstract class Mob extends Char { protected boolean getCloser( int target ) { - if (rooted || target == pos) { + if (rooted || target == pos || !Dungeon.level.insideMap(target)) { return false; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 1d5f31298..6daba590b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -140,7 +140,6 @@ import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.tweeners.Tweener; import com.watabou.utils.Callback; -import com.watabou.utils.DeviceCompat; import com.watabou.utils.GameMath; import com.watabou.utils.PlatformSupport; import com.watabou.utils.Point; @@ -1465,10 +1464,12 @@ public class GameScene extends PixelScene { @Override public void call() { //greater than 0 to account for negative values (which have the first bit set to 1) - if (color > 0 && color < 0x01000000) { - scene.fadeIn(0xFF000000 | color, lightmode); - } else { - scene.fadeIn(color, lightmode); + if (scene != null) { + if (color > 0 && color < 0x01000000) { + scene.fadeIn(0xFF000000 | color, lightmode); + } else { + scene.fadeIn(color, lightmode); + } } } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java index 1f87066f5..a05ce6ef8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java @@ -349,6 +349,9 @@ public class QuickSlotButton extends Button { //FIXME: this is currently very expensive, should either optimize ballistica or this, or both public static int autoAim(Char target, Item item){ + if (Dungeon.hero == null){ + return -1; + } //first try to directly target if (item.targetingPos(Dungeon.hero, target.pos) == target.pos) {