mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[BugFix] Remove potential nullptrs in Virus Code (#1658)
This commit is contained in:
parent
9e7a763482
commit
9af7122b1d
@ -5237,6 +5237,11 @@ std::vector<Mob*> EntityList::GetTargetsForVirusEffect(Mob *spreader, Mob *origi
|
|||||||
bool is_detrimental_spell = IsDetrimentalSpell(spell_id);
|
bool is_detrimental_spell = IsDetrimentalSpell(spell_id);
|
||||||
for (auto &it : entity_list.GetCloseMobList(spreader, range)) {
|
for (auto &it : entity_list.GetCloseMobList(spreader, range)) {
|
||||||
Mob *mob = it.second;
|
Mob *mob = it.second;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mob == spreader) {
|
if (mob == spreader) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -5259,6 +5264,10 @@ std::vector<Mob*> EntityList::GetTargetsForVirusEffect(Mob *spreader, Mob *origi
|
|||||||
// Make sure the target is in range
|
// Make sure the target is in range
|
||||||
if (mob->CalculateDistance(spreader->GetX(), spreader->GetY(), spreader->GetZ()) <= 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.
|
//Do not allow detrimental spread to anything the original caster couldn't normally attack.
|
||||||
if (is_detrimental_spell && !original_caster->IsAttackAllowed(mob, true)) {
|
if (is_detrimental_spell && !original_caster->IsAttackAllowed(mob, true)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -8591,6 +8591,11 @@ void Mob::VirusEffectProcess()
|
|||||||
void Mob::SpreadVirusEffect(int32 spell_id, uint32 caster_id, int32 buff_tics_remaining)
|
void Mob::SpreadVirusEffect(int32 spell_id, uint32 caster_id, int32 buff_tics_remaining)
|
||||||
{
|
{
|
||||||
Mob *caster = entity_list.GetMob(caster_id);
|
Mob *caster = entity_list.GetMob(caster_id);
|
||||||
|
|
||||||
|
if (!caster) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Mob *> targets_in_range = entity_list.GetTargetsForVirusEffect(
|
std::vector<Mob *> targets_in_range = entity_list.GetTargetsForVirusEffect(
|
||||||
this,
|
this,
|
||||||
caster,
|
caster,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user