From 5f02c480c2b130a0f58c2c156f040eba009fc49f Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 09:50:10 +0100 Subject: [PATCH] Fix FootpathRemoveAction crashing with invalid coordinates. --- src/openrct2/actions/FootpathRemoveAction.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openrct2/actions/FootpathRemoveAction.hpp b/src/openrct2/actions/FootpathRemoveAction.hpp index 61eaed8dbf..8e7335bf53 100644 --- a/src/openrct2/actions/FootpathRemoveAction.hpp +++ b/src/openrct2/actions/FootpathRemoveAction.hpp @@ -62,6 +62,11 @@ public: } TileElement* footpathElement = GetFootpathElement(); + if (footpathElement == nullptr) + { + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE); + } + res->Cost = GetRefundPrice(footpathElement); return res; @@ -90,6 +95,10 @@ public: tile_element_remove(footpathElement); footpath_update_queue_chains(); } + else + { + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE); + } res->Cost = GetRefundPrice(footpathElement);