diff options
author | rubidium <rubidium@openttd.org> | 2013-07-17 18:37:13 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-07-17 18:37:13 +0000 |
commit | fb1d479a512484a2dc4d25528db13f8380d8ed64 (patch) | |
tree | 1bf7d3e535e8b292d298189d5f659c8334064771 /src | |
parent | b6a624bb9202168a178553a0390442293eb20522 (diff) | |
download | openttd-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')
-rw-r--r-- | src/timetable_cmd.cpp | 6 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 6 |
2 files changed, 6 insertions, 6 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; diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 27f73c525..0a846915f 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -328,9 +328,9 @@ struct TimetableWindow : Window { this->SetWidgetDisabledState(WID_VT_CLEAR_SPEED, disable_speed); this->SetWidgetDisabledState(WID_VT_SHARED_ORDER_LIST, !v->IsOrderListShared()); - this->EnableWidget(WID_VT_START_DATE); - this->EnableWidget(WID_VT_RESET_LATENESS); - this->EnableWidget(WID_VT_AUTOFILL); + this->SetWidgetDisabledState(WID_VT_START_DATE, v->orders.list == NULL); + this->SetWidgetDisabledState(WID_VT_RESET_LATENESS, v->orders.list == NULL); + this->SetWidgetDisabledState(WID_VT_AUTOFILL, v->orders.list == NULL); } else { this->DisableWidget(WID_VT_START_DATE); this->DisableWidget(WID_VT_CHANGE_TIME); |