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:
commit
18f2eafde5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user