فهرست منبع

Fixed a crash

Fixed a crash from trying to access nonexisting map-element.
Xilmi 1 سال پیش
والد
کامیت
2d783211ce
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  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