Fix rare crash in AI code
Reported in https://forums.wesnoth.org/viewtopic.php?p=626344#p626344 Regression from commita3d5b9d603
. The crash occurred when * the attacker had only one weapon * the said weapon was disabled, and - the defender had no weapons - the defender had only one weapon, or - all defender's weapons were disabled (cherry-picked from commit4d569815d0
)
This commit is contained in:
parent
5621fbb643
commit
fe19bdaf44
1 changed files with 1 additions and 0 deletions
|
@ -563,6 +563,7 @@ int battle_context::choose_attacker_weapon(const unit& attacker,
|
|||
attacker, attacker_loc, choices[0], true, defender, defender_loc, def_weapon, units));
|
||||
|
||||
if(attacker_stats_->disable) {
|
||||
attacker_stats_.reset();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue