v3.3.0: added some more safety checks to quickslot buttons
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user