aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-01-01 17:17:49 -0300
committerShauren <shauren.trinity@gmail.com>2021-04-27 23:56:35 +0200
commitb426e64c39d47b70a92fe029c0af7bbf85ea9d30 (patch)
treed993b7b51cdef6f177635f5254f9ea145d8aea58 /src/server/game/Entities
parente0afca513a9bfbd82134942e1266e46811707cbb (diff)
Core/Entities: fix crash
- m_currentSpells and spell would be different in case cancelation of a channeled spell would remove the aura, and aura scripted to cast another channeled spell on remove - In the above situation, we would lose reference of currentSpell and remove reference from wrong one, this was fixed by clearing the pointer before spell cancelation. Closes #20172 (cherry picked from commit 5e284d4b3826cd345193298688c1d2bc5b3c8f72)
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f0fb4fd7efc..91763b7e685 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3093,14 +3093,15 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendAutoRepeatCancel(this);
+ m_currentSpells[spellType] = nullptr;
+
if (spell->getState() != SPELL_STATE_FINISHED)
spell->cancel();
+ else
+ spell->SetReferencedFromCurrent(false);
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
ToCreature()->AI()->OnSpellCastInterrupt(spell->GetSpellInfo());
-
- m_currentSpells[spellType] = nullptr;
- spell->SetReferencedFromCurrent(false);
}
}