Fix nullptr dereference when autoreplacing vehicle with no orders

In GetIncompatibleRefitOrderIdForAutoreplace
This commit is contained in:
Jonathan G Rennison
2021-06-19 18:44:43 +01:00
parent 6c7fccff5d
commit 4577b547ea

View File

@@ -208,6 +208,7 @@ static int GetIncompatibleRefitOrderIdForAutoreplace(const Vehicle *v, EngineID
const Vehicle *u = (v->type == VEH_TRAIN) ? v->First() : v;
const OrderList *orders = u->orders.list;
if (orders == nullptr) return -1;
for (VehicleOrderID i = 0; i < orders->GetNumOrders(); i++) {
o = orders->GetOrderAt(i);
if (!o->IsRefit()) continue;