Fix #8169: nullptr dereference when autoreplacing vehicle with no orders (#9387)

This commit is contained in:
Jonathan G Rennison 2021-06-19 22:31:23 +01:00 committed by GitHub
parent 052f6b5d9f
commit 8a33e98834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -207,6 +207,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;