Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix invalid vector index (bug #21402)

  • Loading branch information...
commit 3a2c24d2d087770f158d2aafd3411af050221c5c 1 parent 4a9ca54
Alexander van Gessel AI0867 authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/actions/attack.cpp
3  src/actions/attack.cpp
View
@@ -481,8 +481,9 @@ int battle_context::choose_attacker_weapon(const unit &attacker,
if (choices.size() == 1) {
*defender_weapon = choose_defender_weapon(attacker, defender, choices[0], units,
attacker_loc, defender_loc, prev_def);
+ const attack_type *def_weapon = *defender_weapon >= 0 ? &defender.attacks()[*defender_weapon] : NULL;
attacker_stats_ = new battle_context_unit_stats(attacker, attacker_loc, choices[0],
- true, defender, defender_loc, &defender.attacks()[*defender_weapon], units);
+ true, defender, defender_loc, def_weapon, units);
if (attacker_stats_->disable) {
delete attacker_stats_;
attacker_stats_ = NULL;
Please sign in to comment.
Something went wrong with that request. Please try again.