Fix rare crash in AI code
Reported in https://forums.wesnoth.org/viewtopic.php?p=626344#p626344
Regression from commit a3d5b9d603
.
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
This commit is contained in:
parent
ca16166f1a
commit
9595307989
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