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 authored and Ovahlord committed 2023-07-21 01:05:41 +02:00
1 parent 06aacf757d
commit 4b7aefb05b
1 file changed
+6
+6
View File
@@ -9586,6 +9586,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());