# HG changeset patch # User rubidium # Date 2009-04-13 21:30:21 # Node ID cf4bbad53b34ce49b0e416ef3548433304cf6f4f # Parent 861145a5d1ca4a558eae449337d24361b39d5a6e (svn r16056) -Fix (r16037): clicking twice on the "end of orders" crashed. diff --git a/src/order_gui.cpp b/src/order_gui.cpp --- 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));