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
This commit is contained in:
1 parent
4b9415a916
commit
a53af26ab6
2 files changed
+15
-11
No files matched your search
@@ -3000,13 +3000,14 @@ 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();
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
ToCreature()->AI()->OnSpellCastInterrupt(spell->GetSpellInfo());
|
||||
|
||||
m_currentSpells[spellType] = NULL;
|
||||
spell->SetReferencedFromCurrent(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user