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

Port From (https://github.com/TrinityCore/TrinityCore/commit/40cdf0750d40668692660db817c5fc19d53aea2e)
This commit is contained in:
hondacrx
2023-09-04 08:02:03 -04:00
parent 6dbfdf51f6
commit 04250a71f8
+6
View File
@@ -518,6 +518,12 @@ namespace Game.Entities
if (IsInWorld)
RemoveFromWorld();
else
{
// cleanup that must happen even if not in world
if (IsVehicle())
RemoveVehicleKit(true);
}
// A unit may be in removelist and not in world, but it is still in grid
// and may have some references during delete