diff options
author | celestar <celestar@openttd.org> | 2005-02-05 15:05:52 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-02-05 15:05:52 +0000 |
commit | 527f3b3b791d26099847e83d5a3c71cfe4c081b7 (patch) | |
tree | 0b3eb4e8acc1eef017357c4df82baa04a9aafcfb | |
parent | de0bb8b971cce57701f008230cf649b5f0de85a5 (diff) | |
download | openttd-527f3b3b791d26099847e83d5a3c71cfe4c081b7.tar.xz |
(svn r1801) -Fix [Multistop] Fixed a crash that occured when copying orders due to not checking a pointer to be non-NULL
-rw-r--r-- | order_cmd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/order_cmd.c b/order_cmd.c index b03305f4b..71ab2c068 100644 --- a/order_cmd.c +++ b/order_cmd.c @@ -485,14 +485,18 @@ int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 veh1_veh2, uint32 mode) /* Trucks can't copy all the orders from busses (and visa versa) */ if (src->type == VEH_Road) { const Order *order; - TileIndex required_dst; + TileIndex required_dst = INVALID_TILE; FOR_VEHICLE_ORDERS(src, order) { if (order->type == OT_GOTO_STATION) { const Station *st = GetStation(order->station); - required_dst = (dst->cargo_type == CT_PASSENGERS) ? st->bus_stops->xy : st->truck_stops->xy; + if (dst->cargo_type == CT_PASSENGERS) { + if (st->bus_stops != NULL) required_dst = st->bus_stops->xy; + } else { + if (st->truck_stops != NULL) required_dst = st->truck_stops->xy; + } /* This station has not the correct road-bay, so we can't copy! */ - if (!required_dst) + if (required_dst == INVALID_TILE) return CMD_ERROR; } } |