From 9e26bf6a7f7dcf0802ca87cb976da7b5df24ff56 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 9 Jan 2025 13:23:48 +0100 Subject: Core/Auras: Make iteration over Aura::GetAuraEffects safe by automatically skipping nullptr elements (cherry picked from commit 97f58a59f13fcf3a8a6675215674fb89b1a136ca) # Conflicts: # src/server/game/Entities/Player/Player.cpp --- src/server/game/Spells/Spell.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index fb4e5a00c1e..2d299e28296 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3284,9 +3284,8 @@ void Spell::DoSpellEffectHit(Unit* unit, SpellEffectInfo const& spellEffectInfo, int32 origDuration = hitInfo.AuraDuration; hitInfo.AuraDuration = 0; for (AuraEffect const* auraEff : hitInfo.HitAura->GetAuraEffects()) - if (auraEff) - if (int32 period = auraEff->GetPeriod()) // period is hastened by UNIT_MOD_CAST_SPEED - hitInfo.AuraDuration = std::max(std::max(origDuration / period, 1) * period, hitInfo.AuraDuration); + if (int32 period = auraEff->GetPeriod()) // period is hastened by UNIT_MOD_CAST_SPEED + hitInfo.AuraDuration = std::max(std::max(origDuration / period, 1) * period, hitInfo.AuraDuration); // if there is no periodic effect if (!hitInfo.AuraDuration) -- cgit v1.2.3