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 a05ce6ef8..dbc83caca 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java @@ -73,6 +73,7 @@ public class QuickSlotButton extends Button { instance = new QuickSlotButton[QuickSlot.SIZE]; lastTarget = null; + targetingSlot = -1; } @Override @@ -85,7 +86,7 @@ public class QuickSlotButton extends Button { if (!Dungeon.hero.isAlive() || !Dungeon.hero.ready){ return; } - if (targetingSlot == slotNum) { + if (targetingSlot == slotNum && lastTarget != null) { int cell = autoAim(lastTarget, select(slotNum)); if (cell != -1){ @@ -349,7 +350,7 @@ 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){ + if (Dungeon.hero == null || target == null){ return -1; }