Fix crash when road vehicle leaves bus/truck stop when it is has no orders

This commit is contained in:
Jonathan G Rennison
2022-04-02 13:39:45 +01:00
parent f86f77b7a5
commit a8d99215d7

View File

@@ -1568,6 +1568,8 @@ inline byte IncreaseOvertakingCounter(RoadVehicle *v)
static bool CheckRestartLoadingAtRoadStop(RoadVehicle *v)
{
if (v->GetNumOrders() < 1) return false;
StationID station_id = v->current_order.GetDestination();
VehicleOrderID next_order_idx = AdvanceOrderIndexDeferred(v, v->cur_implicit_order_index);
const Order *next_order = v->GetOrder(next_order_idx);