1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 07:14:31 +01:00

Remove unnecessary null checks

static_cast on a nullptr is defined behaviour.
This commit is contained in:
Hielke Morsink
2022-05-15 11:18:15 +02:00
parent f9676d1863
commit 1a3dae6f56
2 changed files with 4 additions and 4 deletions

View File

@@ -64,6 +64,6 @@ void TerrainEdgeObject::ReadJson(IReadObjectContext* context, json_t& root)
TerrainEdgeObject* TerrainEdgeObject::GetById(ObjectEntryIndex entryIndex)
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
auto obj = objMgr.GetLoadedObject(ObjectType::TerrainEdge, entryIndex);
return obj != nullptr ? static_cast<TerrainEdgeObject*>(obj) : nullptr;
auto* obj = objMgr.GetLoadedObject(ObjectType::TerrainEdge, entryIndex);
return static_cast<TerrainEdgeObject*>(obj);
}

View File

@@ -160,6 +160,6 @@ uint32_t TerrainSurfaceObject::GetImageId(
TerrainSurfaceObject* TerrainSurfaceObject::GetById(ObjectEntryIndex entryIndex)
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
auto obj = objMgr.GetLoadedObject(ObjectType::TerrainSurface, entryIndex);
return obj != nullptr ? static_cast<TerrainSurfaceObject*>(obj) : nullptr;
auto* obj = objMgr.GetLoadedObject(ObjectType::TerrainSurface, entryIndex);
return static_cast<TerrainSurfaceObject*>(obj);
}