From 844cb32a883ed44f079a73092a1bcf54d0d2e2cb Mon Sep 17 00:00:00 2001 From: pelya Date: Sun, 3 Apr 2016 13:55:34 +0300 Subject: [PATCH] Lazy fix for crash https://bugs.openttd.org/task/6437 --- src/economy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/economy.cpp b/src/economy.cpp index d78d2cccec..6281c08cdd 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1637,7 +1637,7 @@ static void LoadUnloadVehicle(Vehicle *front) CargoPayment *payment = front->cargo_payment; uint artic_part = 0; // Articulated part we are currently trying to load. (not counting parts without capacity) - for (Vehicle *v = front; v != NULL; v = v->Next()) { + for (Vehicle *v = front; v != NULL && payment != NULL; v = v->Next()) { if (v == front || !v->Previous()->HasArticulatedPart()) artic_part = 0; if (v->cargo_cap == 0) continue; artic_part++;