Core/Units: Fixed crash (previously was a memory leak) when vehicle creatures are deleted without ever being added to world

Closes #29166
This commit is contained in:
Shauren
2023-07-21 00:19:48 +02:00
parent 0b1281e73f
commit 40cdf0750d

View File

@@ -9473,6 +9473,12 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
if (IsInWorld())
RemoveFromWorld();
else
{
// cleanup that must happen even if not in world
if (IsVehicle())
RemoveVehicleKit(true);
}
ASSERT(GetGUID());