summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rail_gui.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/rail_gui.c b/rail_gui.c
index 313ea819a..2f6136c01 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -590,6 +590,7 @@ void ShowBuildRailToolbar(RailType railtype, int button)
Window *w;
if (_current_player == OWNER_SPECTATOR) return;
+ if (!ValParamRailtype(railtype)) return;
// don't recreate the window if we're clicking on a button and the window exists.
if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) {