v3.3.0: added some more safety checks to quickslot buttons

This commit is contained in:
Evan Debenham
2025-10-16 13:12:42 -04:00
parent 6f7eba2006
commit dcf74e0d3d

View File

@@ -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;
}