Core/Chat: Fix assert triggered by .npc add

Fix an assert in Aura::_UnapplyForTarget() caused by ".npc add" changing the guid of the spawned Creature.
This commit is contained in:
jackpoz committed 2013-12-29 19:37:20 +01:00
1 parent e016ef3dbd
commit c40cdc2968
1 file changed
+5 -1
+5 -1
View File
@@ -275,7 +275,11 @@ public:
uint32 db_guid = creature->GetDBTableGUIDLow();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
creature->CleanupsBeforeDelete();
delete creature;
creature = new Creature();
if (!creature->LoadCreatureFromDB(db_guid, map))
{
delete creature;