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:
parent
9c52e3a0b2
commit
2d783211ce
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user