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

This commit is contained in:
dP 2023-03-05 02:52:30 +04:00 committed by GitHub
parent 16a7bc54b3
commit 01ebfad809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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));
}
}