1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #5 from janisozaur/develop

fixed possible nullptr dereference
This commit is contained in:
DjWarmonger 2014-04-25 16:37:02 +02:00
commit 18f2eafde5

View File

@ -361,17 +361,18 @@ std::string InfoBoxHeroData::getHoverText()
std::string InfoBoxHeroData::getValueText()
{
if (hero)
{
switch (type)
{
case HERO_MANA:
if (hero)
return boost::lexical_cast<std::string>(hero->mana) + '/' +
boost::lexical_cast<std::string>(hero->manaLimit());
case HERO_EXPERIENCE:
return boost::lexical_cast<std::string>(hero->exp);
default:
return InfoBoxAbstractHeroData::getValueText();
}
}
return InfoBoxAbstractHeroData::getValueText();
}
bool InfoBoxHeroData::prepareMessage(std::string &text, CComponent**comp)