Core/Creature: Add null check for charmed creatures

(cherry picked from commit b4adaa838c2e44f4008152cc955410d25ff4d8b0)
This commit is contained in:
jackpoz
2022-01-22 00:50:40 +01:00
committed by Shauren
parent 120c9f3f74
commit ff778a7581
@@ -3070,7 +3070,7 @@ std::string Creature::GetNameForLocaleIdx(LocaleConstant locale) const
uint32 Creature::GetPetAutoSpellOnPos(uint8 pos) const
{
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
if (pos >= MAX_SPELL_CHARM || !m_charmInfo || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
return 0;
else
return m_charmInfo->GetCharmSpell(pos)->GetAction();