From 2b9a3424b00a9c2fe9531a8609a14be396db31a2 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Thu, 18 Mar 2021 23:28:43 +0100 Subject: [PATCH] Fix #14347: Crash when inserting a tile element without room --- src/openrct2/world/Map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index f98fca3bcd..c1cf6f6b31 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -218,7 +218,7 @@ TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants template T* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants) { auto* element = tile_element_insert(loc, occupiedQuadrants, T::ElementType); - return element->template as(); + return (element != nullptr) ? element->template as() : nullptr; } namespace GameActions