1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00

Fixed a crash

Fixed a crash from trying to access nonexisting map-element.
This commit is contained in:
Xilmi 2024-10-01 01:11:17 +02:00
parent 9c52e3a0b2
commit 2d783211ce

View File

@ -148,7 +148,10 @@ void HeroManager::update()
HeroRole HeroManager::getHeroRole(const HeroPtr & hero) const 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 const std::map<HeroPtr, HeroRole> & HeroManager::getHeroRoles() const