Skip to content

Commit

Permalink
Fix rare crash in AI code
Browse files Browse the repository at this point in the history
Reported in https://forums.wesnoth.org/viewtopic.php?p=626344#p626344

Regression from commit a3d5b9d.

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 commit 4d56981)
  • Loading branch information
jyrkive committed Oct 7, 2018
1 parent 5621fbb commit fe19bda
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/actions/attack.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit fe19bda

Please sign in to comment.