diff --git a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp index 2e9ae12e4..48ddf0277 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp @@ -21,6 +21,12 @@ namespace AIPathfinding { void BuyArmyAction::execute(const CGHeroInstance * hero) const { + if(!hero->visitedTown) + { + throw cannotFulfillGoalException( + hero->name + " being at " + hero->visitablePos().toString() + " has no town to recruit creatures."); + } + ai->recruitCreatures(hero->visitedTown, hero); }