summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-03-24 15:13:46 +0000
committertruelight <truelight@openttd.org>2007-03-24 15:13:46 +0000
commit9a9e891e0c07f46b751fa57b4d946e7de227a8bc (patch)
treeab1e296f3e7382c6f00c81cf76d4565423ee02eb
parentd53e16131def0611ea00dd59bcc8011e22b7d0d8 (diff)
downloadopenttd-9a9e891e0c07f46b751fa57b4d946e7de227a8bc.tar.xz
(svn r9429) -Fix r9338: when deleting a vehicle which has shared orders with one more vehicle and no orders, segfaulted
-rw-r--r--src/order_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index bacf2ab1a..daa2ca366 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -463,6 +463,7 @@ static int32 DecloneOrder(Vehicle *dst, uint32 flags)
*/
static void RemoveSharedOrderVehicleList(Vehicle *v)
{
+ assert(v->orders != NULL);
WindowClass window_class = WC_NONE;
switch (v->type) {
@@ -1159,7 +1160,7 @@ void DeleteVehicleOrders(Vehicle *v)
/* If we are the only one left in the Shared Order Vehicle List,
* remove it, as we are no longer a Shared Order Vehicle */
- if (u->prev_shared == NULL && u->next_shared == NULL) RemoveSharedOrderVehicleList(u);
+ if (u->prev_shared == NULL && u->next_shared == NULL && u->orders != NULL) RemoveSharedOrderVehicleList(u);
/* We only need to update this-one, because if there is a third
* vehicle which shares the same order-list, nothing will change. If