Browse Source

VCAI::performTypicalActions: always check that hero is still available

It's weird why this only appear now so if you have ideas check issue 2479.
Arseniy Shestakov 9 years ago
parent
commit
30042cac3d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      AI/VCAI/VCAI.cpp

+ 3 - 0
AI/VCAI/VCAI.cpp

@@ -2517,6 +2517,9 @@ void VCAI::performTypicalActions()
 {
 	for(auto h : getUnblockedHeroes())
 	{
+		if(!h) //hero might be lost. getUnblockedHeroes() called once on start of turn
+			continue;
+
 		logAi->debugStream() << boost::format("Looking into %s, MP=%d") % h->name.c_str() % h->movement;
 		makePossibleUpgrades(*h);
 		pickBestArtifacts(*h);