Skip to content
Permalink
Browse files

Fix rare crash in AI code

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
  • Loading branch information...
jyrkive committed Apr 23, 2018
1 parent ca16166 commit 95953079895cf5c1cff89b0f7103ac850a3847db
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/actions/attack.cpp
@@ -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;
}

0 comments on commit 9595307

Please sign in to comment.
You can’t perform that action at this time.