Browse Source

Fixed a crash

Fixed a crash from trying to access nonexisting map-element.
Xilmi 1 year ago
parent
commit
2d783211ce
1 changed files with 4 additions and 1 deletions
  1. 4 1
      AI/Nullkiller/Analyzers/HeroManager.cpp

+ 4 - 1
AI/Nullkiller/Analyzers/HeroManager.cpp

@@ -148,7 +148,10 @@ void HeroManager::update()
 
 HeroRole HeroManager::getHeroRole(const HeroPtr & hero) const
 {
-	return heroRoles.at(hero);
+	if (heroRoles.find(hero) != heroRoles.end())
+		return heroRoles.at(hero);
+	else
+		return HeroRole::SCOUT;
 }
 
 const std::map<HeroPtr, HeroRole> & HeroManager::getHeroRoles() const