aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-03-07 23:45:22 +0100
committerShauren <shauren.trinity@gmail.com>2015-03-07 23:45:22 +0100
commit8cd1c9514f336da3d3d9436be554fc80edb6e761 (patch)
treec5fa7ebddb3f33befb0303b0b4be79d3edeeed8a /src
parent38ba7ab08ede208f60c51759f5e107359f01d148 (diff)
Core/Auras: Fixed possible crash in Aura::RefreshDuration - Aura::GetCaster can return NULL
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index cd3b22dfa11..6fa4936ffa0 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -795,12 +795,13 @@ void Aura::SetDuration(int32 duration, bool withMods)
void Aura::RefreshDuration(bool withMods)
{
- if (withMods)
+ Unit* caster = GetCaster();
+ if (withMods && caster)
{
int32 duration = m_spellInfo->GetMaxDuration();
// Calculate duration of periodics affected by haste.
- if (GetCaster()->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION))
- duration = int32(duration * GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
+ if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION))
+ duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
SetMaxDuration(duration);
SetDuration(duration);