Skip to content

Commit

Permalink
Merge pull request MegaMek#4799 from Sleet01/fix_4796_silent_NPE_in_p…
Browse files Browse the repository at this point in the history
…rincess_during_offboard_arty_firing_and_ADA_check

Fix MegaMek#4796
  • Loading branch information
NickAragua authored Sep 21, 2023
2 parents 60603a2 + f508935 commit 59dee6b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,14 @@ public void initializeForTargetingPhase() {
private boolean getADAAvailable(Entity shooter){
boolean available = false;
for (Mounted weapon: shooter.getWeaponList()){
if(((AmmoType) weapon.getLinked().getType()).getMunitionType().contains(AmmoType.Munitions.M_ADA)
&& !weapon.isFired() && weapon.getLinked().getUsableShotsLeft() > 0){
available = true;
break;
if (weapon.getType().hasFlag(WeaponType.F_ARTILLERY)){
if(((AmmoType) weapon.getLinked().getType()).getMunitionType().contains(AmmoType.Munitions.M_ADA)
&& !weapon.isFired() && weapon.getLinked().getUsableShotsLeft() > 0) {
available = true;
break;
}
}
}

return available;
}
/**
Expand Down

0 comments on commit 59dee6b

Please sign in to comment.