From 375ce5c1239399a82c56470dd0bc3f7bcd2e00c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 6 Aug 2023 13:33:31 +0300 Subject: [PATCH] Apply review suggestion --- src/openrct2/world/Footpath.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index c5f8eb7bd2..4de77d1397 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -126,8 +126,9 @@ PathElement* MapGetFootpathElement(const CoordsXYZ& coords) { if (tileElement == nullptr) break; - if (tileElement->GetType() == TileElementType::Path && tileElement->GetBaseZ() == coords.z) - return tileElement->AsPath(); + auto* pathElement = tileElement->AsPath(); + if (pathElement != nullptr && pathElement->GetBaseZ() == coords.z) + return pathElement; } while (!(tileElement++)->IsLastForTile()); return nullptr;