diff --git a/zone/entity.cpp b/zone/entity.cpp index 28bb5e144..8d182fff5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -5237,6 +5237,11 @@ std::vector EntityList::GetTargetsForVirusEffect(Mob *spreader, Mob *origi bool is_detrimental_spell = IsDetrimentalSpell(spell_id); for (auto &it : entity_list.GetCloseMobList(spreader, range)) { Mob *mob = it.second; + + if (!mob) { + continue; + } + if (mob == spreader) { continue; } @@ -5259,6 +5264,10 @@ std::vector EntityList::GetTargetsForVirusEffect(Mob *spreader, Mob *origi // Make sure the target is in range if (mob->CalculateDistance(spreader->GetX(), spreader->GetY(), spreader->GetZ()) <= range) { + if (!original_caster) { + continue; + } + //Do not allow detrimental spread to anything the original caster couldn't normally attack. if (is_detrimental_spell && !original_caster->IsAttackAllowed(mob, true)) { continue; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 44a02fbdd..da3b45fe1 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -8591,6 +8591,11 @@ void Mob::VirusEffectProcess() void Mob::SpreadVirusEffect(int32 spell_id, uint32 caster_id, int32 buff_tics_remaining) { Mob *caster = entity_list.GetMob(caster_id); + + if (!caster) { + return; + } + std::vector targets_in_range = entity_list.GetTargetsForVirusEffect( this, caster,