fix: Crash on ProcessDelayedDamages (#16166)
This commit is contained in:
parent
eea71a415e
commit
3dbdea5e28
2 changed files with 6 additions and 1 deletions
|
|
@ -814,7 +814,7 @@ void Unit::DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb)
|
|||
|
||||
uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool /*allowGM*/, Spell const* damageSpell /*= nullptr*/, bool delayed)
|
||||
{
|
||||
if (delayed && attacker->GetTypeId() == TYPEID_PLAYER && attacker->GetGUID() != victim->GetGUID())
|
||||
if (delayed && attacker && attacker->GetTypeId() == TYPEID_PLAYER && attacker->GetGUID() != victim->GetGUID())
|
||||
{
|
||||
sWorld->AddDelayedDamage(attacker, victim, damage, cleanDamage, damagetype, damageSchoolMask, spellProto, durabilityLoss);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -3357,6 +3357,11 @@ void World::AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanD
|
|||
void World::ProcessDelayedDamages()
|
||||
{
|
||||
for (auto& damage : _delayedDamages)
|
||||
{
|
||||
if (!damage.victim)
|
||||
continue;
|
||||
|
||||
Unit::DealDamage(damage.attacker, damage.victim, damage.damage, damage.cleanDamage, damage.damagetype, damage.damageSchoolMask, damage.spellProto, damage.durabilityLoss);
|
||||
}
|
||||
_delayedDamages.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue