v3.0.0: added hero ref safety checks to isEquipped

This commit is contained in:
Evan Debenham
2024-10-20 12:08:01 -04:00
parent d1ae02b51a
commit c7f0be52f2
2 changed files with 2 additions and 2 deletions

View File

@@ -92,7 +92,7 @@ abstract public class KindOfWeapon extends EquipableItem {
@Override @Override
public boolean isEquipped( Hero hero ) { public boolean isEquipped( Hero hero ) {
return hero.belongings.weapon() == this || hero.belongings.secondWep() == this; return hero != null && (hero.belongings.weapon() == this || hero.belongings.secondWep() == this);
} }
private static boolean isSwiftEquipping = false; private static boolean isSwiftEquipping = false;

View File

@@ -304,7 +304,7 @@ public class Armor extends EquipableItem {
@Override @Override
public boolean isEquipped( Hero hero ) { public boolean isEquipped( Hero hero ) {
return hero.belongings.armor() == this; return hero != null && hero.belongings.armor() == this;
} }
public final int DRMax(){ public final int DRMax(){