Fix #9875. Check for valid tile element before dereferencing

This commit is contained in:
duncanspumpkin committed 2019-08-17 11:06:19 +01:00
1 parent 748a6338a9
commit 486f13440f
1 file changed
+5
+5
View File
@@ -1648,6 +1648,11 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
TileElement* tile_element = map_get_first_element_at(tile.x >> 5, tile.y >> 5);
z = gTrackPreviewOrigin.z / 8;
z += (entrance.z == (int8_t)(uint8_t)0x80) ? -1 : entrance.z;
if (tile_element == nullptr)
{
_trackDesignPlaceCost = MONEY32_UNDEFINED;
return false;
}
do
{