1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Nullkiller: fix crash

This commit is contained in:
Andrii Danylchenko
2022-03-05 15:51:03 +02:00
parent ea2931c6ea
commit 02b2f35143
2 changed files with 13 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInsta
{
if(!ai->nullkiller->isHeroLocked(town->garrisonHero.get()))
{
if(!town->visitingHero)
if(!town->visitingHero && cb->getHeroesInfo().size() < GameConstants::MAX_HEROES_PER_PLAYER)
{
tasks.push_back(Goals::sptr(Goals::ExchangeSwapTownHeroes(town, nullptr).setpriority(5)));
}