summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-13 21:30:21 +0000
committerrubidium <rubidium@openttd.org>2009-04-13 21:30:21 +0000
commit627c042df10f8a7cc8169683713881cff248c1a5 (patch)
tree2a687bdef6d3684f3cbecd07e36f5039900b94c4
parentcd4476fc747eca0a7ca00fe5c0235181d44eceb2 (diff)
downloadopenttd-627c042df10f8a7cc8169683713881cff248c1a5.tar.xz
(svn r16056) -Fix (r16037): clicking twice on the "end of orders" crashed.
-rw-r--r--src/order_gui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index b0dfb8f52..e2a93e87b 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -876,7 +876,7 @@ public:
/* Deselect clicked order */
this->selected_order = -1;
} else if (sel == this->selected_order) {
- if (this->vehicle->type == VEH_TRAIN) {
+ if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) {
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16),
MOF_STOP_LOCATION | ((GetVehicleOrder(this->vehicle, sel)->GetStopLocation() + 1) % OSL_END) << 4,
CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));