mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 02:19:41 +00:00
(svn r9429) -Fix r9338: when deleting a vehicle which has shared orders with one more vehicle and no orders, segfaulted
This commit is contained in:
parent
d53e16131d
commit
9a9e891e0c
@ -463,6 +463,7 @@ static int32 DecloneOrder(Vehicle *dst, uint32 flags)
|
|||||||
*/
|
*/
|
||||||
static void RemoveSharedOrderVehicleList(Vehicle *v)
|
static void RemoveSharedOrderVehicleList(Vehicle *v)
|
||||||
{
|
{
|
||||||
|
assert(v->orders != NULL);
|
||||||
WindowClass window_class = WC_NONE;
|
WindowClass window_class = WC_NONE;
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
@ -1159,7 +1160,7 @@ void DeleteVehicleOrders(Vehicle *v)
|
|||||||
|
|
||||||
/* If we are the only one left in the Shared Order Vehicle List,
|
/* If we are the only one left in the Shared Order Vehicle List,
|
||||||
* remove it, as we are no longer a Shared Order Vehicle */
|
* 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
|
/* We only need to update this-one, because if there is a third
|
||||||
* vehicle which shares the same order-list, nothing will change. If
|
* vehicle which shares the same order-list, nothing will change. If
|
||||||
|
Loading…
Reference in New Issue
Block a user