Fix 3719f60: Crash when copying non-station orders (#10540)

pull/495/head
dP 1 year ago committed by GitHub
parent 16a7bc54b3
commit 01ebfad809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1577,8 +1577,9 @@ CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID ve
/* Trucks can't copy all the orders from busses (and visa versa),
* and neither can helicopters and aircraft. */
for (const Order *order : src->Orders()) {
if (!OrderGoesToStation(dst, order)) continue;
Station *st = Station::Get(order->GetDestination());
if (OrderGoesToStation(dst, order) && !CanVehicleUseStation(dst, st)) {
if (!CanVehicleUseStation(dst, st)) {
return CommandCost(STR_ERROR_CAN_T_COPY_SHARE_ORDER, GetVehicleCannotUseStationReason(dst, st));
}
}

Loading…
Cancel
Save