summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 356d11335..0f321dfb6 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -414,6 +414,9 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RoadBits pieces = Extract<RoadBits, 0>(p1);
+ /* do not allow building 'zero' road bits, code wouldn't handle it */
+ if (pieces == ROAD_NONE) return CMD_ERROR;
+
RoadType rt = (RoadType)GB(p1, 4, 2);
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;