summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-26 12:55:12 +0000
committerrubidium <rubidium@openttd.org>2010-12-26 12:55:12 +0000
commitb06b05c360830efe5a689a9340b1d327f5d45189 (patch)
treeb43a2913ad3f66860147bb7faf469f6ec1e1984b /src
parent64f04c3a74be3769a3e0bbf2e1c68bd27d6579eb (diff)
downloadopenttd-b06b05c360830efe5a689a9340b1d327f5d45189.tar.xz
(svn r21643) -Fix (r21642): crash when a train with no orders (or actually no order list) stops at a station
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 9dc25a2dd..ce1f2abba 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1764,7 +1764,7 @@ void Vehicle::BeginLoading()
/* We weren't scheduled to stop here. Insert an automatic order
* to show that we are stopping here. */
Order *in_list = this->GetOrder(this->cur_order_index);
- if (this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID &&
+ if ((this->orders.list == NULL || this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID) &&
((in_list == NULL && this->cur_order_index == 0) ||
(in_list != NULL && (!in_list->IsType(OT_AUTOMATIC) ||
in_list->GetDestination() != this->last_station_visited)))) {