Browse Source

Fix crash on sieging Citadel or Castle

Ivan Savenko 1 year ago
parent
commit
0e4be8c776
1 changed files with 3 additions and 0 deletions
  1. 3 0
      AI/BattleAI/BattleExchangeVariant.cpp

+ 3 - 0
AI/BattleAI/BattleExchangeVariant.cpp

@@ -621,6 +621,9 @@ BattleScore BattleExchangeEvaluator::calculateExchange(
 						if(!exchangeBattle->getForUpdate(u->unitId())->alive())
 							return false;
 
+						if (!u->getPosition().isValid())
+							return false; // e.g. tower shooters
+
 						return vstd::contains_if(reachabilityMap.at(u->getPosition()), [&attacker](const battle::Unit * other) -> bool
 							{
 								return attacker->unitId() == other->unitId();