summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeterN <peter1138@openttd.org>2019-05-10 21:07:38 +0100
committerGitHub <noreply@github.com>2019-05-10 21:07:38 +0100
commitf4921d2c3ee25139c77278da5fc33194f0cbf075 (patch)
treeb7d516f593ed6527c06f1b07be4b3b3b893eddc6
parent24c59283ecc334615bf68bf4d8a2fb258339a278 (diff)
downloadopenttd-f4921d2c3ee25139c77278da5fc33194f0cbf075.tar.xz
Fix #7576: Crash when destroying rail/tram crossing. (#7579)
-rw-r--r--src/road_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 9ade036f0..87da8186c 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1263,7 +1263,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
/* Must iterate over the roadtypes in a reverse manner because
* tram tracks must be removed before the road bits. */
for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
- if (GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue;
+ if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue;
CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, false);
if (tmp_ret.Failed()) return tmp_ret;