From c46f3da9ab1953204d14e98fb5d2bc397af24630 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 4 May 2011 02:35:44 +0000 Subject: [PATCH] Fixed potential NULL dereference. --- client/CPlayerInterface.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 2afecc718..90878f54d 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -574,16 +574,18 @@ void CPlayerInterface::battleStacksHealedRes(const std::vectorbattleGetStackByID(healedStacks[0].first, false); const CStack *defender = cb->battleGetStackByID(lifeDrainFrom, false); + int textOff = 0; + if (attacker) { battleInt->displayEffect(50, attacker->position); + if (attacker->count > 1) + { + textOff += 1; + } } + //print info about life drain - int textOff = 0; - if (attacker->count > 1) - { - textOff += 1; - } char textBuf[1000]; sprintf(textBuf, CGI->generaltexth->allTexts[361 + textOff].c_str(), attacker->getCreature()->nameSing.c_str(), healedStacks[0].second, defender->getCreature()->namePl.c_str());