Core/Transports: fixed a crash when loading db spawned transports

* fixed a memory leak
This commit is contained in:
Ovahlord
2019-02-25 04:39:01 +01:00
parent 8110e13914
commit 1f76228c1b
2 changed files with 12 additions and 6 deletions

View File

@@ -149,6 +149,7 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, uint
ASSERT(map);
SetMap(map);
UpdatePositionData();
SetZoneScript();
if (GetZoneScript())
{
@@ -161,6 +162,8 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, uint
if (!dynamic)
SetRespawnCompatibilityMode();
guidlow = map->GenerateLowGuid<HighGuid::Transport>();
if (!Transport::CreateTransport(guidlow, entry, map->GetId(), pos, animprogress))
return false;

View File

@@ -197,15 +197,18 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<Gam
continue;
}
}
}
if (!obj->LoadFromDB(guid, map, false, false))
{
if (!obj->LoadFromDB(guid, map, false, false))
{
delete obj;
continue;
}
AddObjectHelper(cell, m, count, map, obj);
}
else
delete obj;
continue;
}
AddObjectHelper(cell, m, count, map, obj);
}
}