From a8d99215d73ea7a2c3618ac3f77be0a3c40d64b6 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 2 Apr 2022 13:39:45 +0100 Subject: [PATCH] Fix crash when road vehicle leaves bus/truck stop when it is has no orders --- src/roadveh_cmd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index bdbe06698b..fdeab17d4d 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -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);