1
0

make sure to remove spell effect so we don't try to access a dead spell ptr later

This commit is contained in:
Emagi 2025-01-21 09:20:04 -05:00
parent 19cd63878c
commit 883f172312

View File

@ -892,8 +892,14 @@ void LuaInterface::RemoveSpell(LuaSpell* spell, bool call_remove_function, bool
ResetFunctionStack(spell->state); ResetFunctionStack(spell->state);
} }
if(return_after_call_remove) if(return_after_call_remove) {
if(overrideTarget && overrideTarget->IsEntity()) {
((Entity*)overrideTarget)->RemoveProc(0, spell);
((Entity*)overrideTarget)->RemoveSpellEffect(spell);
((Entity*)overrideTarget)->RemoveSpellBonus(spell);
}
return; return;
}
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__); spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
if(spell->caster) { if(spell->caster) {