Skip to content

Commit

Permalink
aDD nullptr CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Mar 18, 2024
1 parent f200fe8 commit 9106c92
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/game/chars/CCharAct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,7 @@ bool CChar::ItemEquip( CItem * pItem, CChar * pCharMsg, bool fFromDClick )
void CChar::EatAnim( CItem* pItem, ushort uiQty )
{
ADDTOCALLSTACK("CChar::EatAnim");
ASSERT(pItem);
static const SOUND_TYPE sm_EatSounds[] = { 0x03a, 0x03b, 0x03c };
Sound(sm_EatSounds[Calc_GetRandVal(ARRAY_COUNT(sm_EatSounds))]);

Expand All @@ -2241,9 +2242,12 @@ void CChar::EatAnim( CItem* pItem, ushort uiQty )

if (!(g_Cfg.m_iEmoteFlags & EMOTEF_EAT))
{
tchar * pszMsg = Str_GetTemp();
snprintf(pszMsg, Str_TempLength(), g_Cfg.GetDefaultMsg(DEFMSG_MSG_EATSOME), pItem->GetName());
Emote(pszMsg);
if (pItem != nullptr)
{
tchar * pszMsg = Str_GetTemp();
snprintf(pszMsg, Str_TempLength(), g_Cfg.GetDefaultMsg(DEFMSG_MSG_EATSOME), pItem->GetName());
Emote(pszMsg);
}
}

ushort uiHits = 0;
Expand Down

0 comments on commit 9106c92

Please sign in to comment.