summaryrefslogtreecommitdiff
path: root/src/timetable_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-07-17 18:37:13 +0000
committerrubidium <rubidium@openttd.org>2013-07-17 18:37:13 +0000
commitfb1d479a512484a2dc4d25528db13f8380d8ed64 (patch)
tree1bf7d3e535e8b292d298189d5f659c8334064771 /src/timetable_cmd.cpp
parentb6a624bb9202168a178553a0390442293eb20522 (diff)
downloadopenttd-fb1d479a512484a2dc4d25528db13f8380d8ed64.tar.xz
(svn r25617) -Fix [FS#5655] (r25377): crash when Ctrl+clicking the start date button in timetable window without any orders
Diffstat (limited to 'src/timetable_cmd.cpp')
-rw-r--r--src/timetable_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index a25f0b09a..5b7a69d8e 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -166,7 +166,7 @@ CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1,
VehicleID veh = GB(p1, 0, 20);
Vehicle *v = Vehicle::GetIfValid(veh);
- if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
@@ -235,7 +235,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
{
bool timetable_all = HasBit(p1, 20);
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
- if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
@@ -302,7 +302,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1,
VehicleID veh = GB(p1, 0, 20);
Vehicle *v = Vehicle::GetIfValid(veh);
- if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;