From 7582afe0b470ae44e112de8f6fbf213538e3c0bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 11 Nov 2018 19:17:08 +0100 Subject: [PATCH] Fix #8248: Invalid tile element in footpath_element_insert (#8249) * Fix #8248: Invalid tile element in footpath_element_insert * Update Footpath.cpp --- src/openrct2/world/Footpath.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 12e1aa6ed4..6151994041 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -247,6 +247,11 @@ static money32 footpath_element_insert( tileElement = map_get_surface_element_at({ x, y }); + if (tileElement == nullptr) + { + return MONEY32_UNDEFINED; + } + int32_t supportHeight = z - tileElement->base_height; gFootpathPrice += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / 2) * MONEY(5, 00);