mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Fixed potential NULL dereference.
This commit is contained in:
parent
0c3f3c67a9
commit
c46f3da9ab
@ -574,16 +574,18 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
|
|||||||
{
|
{
|
||||||
const CStack *attacker = cb->battleGetStackByID(healedStacks[0].first, false);
|
const CStack *attacker = cb->battleGetStackByID(healedStacks[0].first, false);
|
||||||
const CStack *defender = cb->battleGetStackByID(lifeDrainFrom, false);
|
const CStack *defender = cb->battleGetStackByID(lifeDrainFrom, false);
|
||||||
|
int textOff = 0;
|
||||||
|
|
||||||
if (attacker)
|
if (attacker)
|
||||||
{
|
{
|
||||||
battleInt->displayEffect(50, attacker->position);
|
battleInt->displayEffect(50, attacker->position);
|
||||||
}
|
|
||||||
//print info about life drain
|
|
||||||
int textOff = 0;
|
|
||||||
if (attacker->count > 1)
|
if (attacker->count > 1)
|
||||||
{
|
{
|
||||||
textOff += 1;
|
textOff += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//print info about life drain
|
||||||
char textBuf[1000];
|
char textBuf[1000];
|
||||||
sprintf(textBuf, CGI->generaltexth->allTexts[361 + textOff].c_str(), attacker->getCreature()->nameSing.c_str(),
|
sprintf(textBuf, CGI->generaltexth->allTexts[361 + textOff].c_str(), attacker->getCreature()->nameSing.c_str(),
|
||||||
healedStacks[0].second, defender->getCreature()->namePl.c_str());
|
healedStacks[0].second, defender->getCreature()->namePl.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user