diff --git a/zone/spells.cpp b/zone/spells.cpp index 45c52a48b..90efd791f 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1732,7 +1732,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce } else if(IsRaidGrouped()) { - group_id_caster = (GetRaid()->GetGroup(CastToClient()) == 0xFFFF) ? 0 : (GetRaid()->GetGroup(CastToClient()) + 1); + if (Raid* raid = GetRaid()) { + uint32 group_id = raid->GetGroup(CastToClient()); + group_id_caster = (group_id == 0xFFFFFFFF) ? 0 : (group_id + 1); + } } } else if(IsPet()) @@ -1744,7 +1747,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce } else if(owner->IsRaidGrouped()) { - group_id_caster = (owner->GetRaid()->GetGroup(CastToClient()) == 0xFFFF) ? 0 : (owner->GetRaid()->GetGroup(CastToClient()) + 1); + if (Raid* raid = owner->GetRaid()) { + uint32 group_id = raid->GetGroup(owner->CastToClient()); + group_id_caster = (group_id == 0xFFFFFFFF) ? 0 : (group_id + 1); + } } } #ifdef BOTS @@ -1770,7 +1776,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce } else if(spell_target->IsRaidGrouped()) { - group_id_target = (spell_target->GetRaid()->GetGroup(CastToClient()) == 0xFFFF) ? 0 : (spell_target->GetRaid()->GetGroup(CastToClient()) + 1); + if (Raid* raid = spell_target->GetRaid()) { + uint32 group_id = raid->GetGroup(spell_target->CastToClient()); + group_id_target = (group_id == 0xFFFFFFFF) ? 0 : (group_id + 1); + } } } else if(spell_target->IsPet()) @@ -1782,7 +1791,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce } else if(owner->IsRaidGrouped()) { - group_id_target = (owner->GetRaid()->GetGroup(CastToClient()) == 0xFFFF) ? 0 : (owner->GetRaid()->GetGroup(CastToClient()) + 1); + if (Raid* raid = owner->GetRaid()) { + uint32 group_id = raid->GetGroup(owner->CastToClient()); + group_id_target = (group_id == 0xFFFFFFFF) ? 0 : (group_id + 1); + } } } #ifdef BOTS