Core/Transports: Log an error if a Transport has no GameObject template

Log an error if a Transport has no GameObject template from `gameobject_template` table instead of dereferencing NULL .
This commit is contained in:
jackpoz
2013-11-29 20:57:51 +01:00
parent 4416c16045
commit 3b471f495c

View File

@@ -60,6 +60,12 @@ void TransportMgr::LoadTransportTemplates()
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
if (goInfo == NULL)
{
TC_LOG_ERROR("sql.sql", "Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
continue;
}
if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size())
{
TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathId);