diff options
author | Jonathan G Rennison <j.g.rennison@gmail.com> | 2021-06-19 22:31:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-19 23:31:23 +0200 |
commit | 8a33e988340e6a4021e18f1c7b412c8ce53572fb (patch) | |
tree | 4b19c93e294e9447285f9f09b72560f23396890a /src | |
parent | 052f6b5d9fd17ca38105b27e5a1d616dacc2e2da (diff) | |
download | openttd-8a33e988340e6a4021e18f1c7b412c8ce53572fb.tar.xz |
Fix #8169: nullptr dereference when autoreplacing vehicle with no orders (#9387)
Diffstat (limited to 'src')
-rw-r--r-- | src/autoreplace_cmd.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 9e82944b6..4f9cf92bb 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -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; |