From 9a2af04753f270687bc42689fa29cdd53112497c Mon Sep 17 00:00:00 2001 From: killerwife Date: Wed, 27 Nov 2024 08:06:15 +0100 Subject: [PATCH] Chat: Fix crash due to deleting a corpse of a dynguid mob --- src/game/Chat/Level2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 4dfd98ffe8c..09294305dbd 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -1922,7 +1922,9 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args) case CREATURE_SUBTYPE_GENERIC: { unit->CombatStop(); - if (CreatureData const* data = sObjectMgr.GetCreatureData(unit->GetDbGuid())) + if (unit->IsUsingNewSpawningSystem()) // might be used in spawn group or scheduled for respawn already + unit->AddObjectToRemoveList(); + else if (CreatureData const* data = sObjectMgr.GetCreatureData(unit->GetDbGuid())) { // chat commands execute in world thread so should be thread safe for now sMapMgr.DoForAllMapsWithMapId(data->mapid, [&](Map* map)