summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-23 07:17:00 +0000
committerrubidium <rubidium@openttd.org>2010-12-23 07:17:00 +0000
commite2a7ecbcaee04068c5504f0b6aa2be1b26e3f298 (patch)
tree632eaeaf92c099641bf0ff9ce43fd830f80335bb /src/economy.cpp
parent256fe89b38b21738154e606137bdeb997a2a1565 (diff)
downloadopenttd-e2a7ecbcaee04068c5504f0b6aa2be1b26e3f298.tar.xz
(svn r21605) -Fix [FS#4324]: crash due to cargo payments belonging to an non-existing company
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 9d7d78143..886a07658 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -382,6 +382,9 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
v->colourmap = PAL_NONE;
if (v->IsEngineCountable()) Company::Get(new_owner)->num_engines[v->engine_type]++;
if (v->IsPrimaryVehicle()) v->unitnumber = unitidgen[v->type].NextID();
+
+ /* Invalidate the vehicle's cargo payment "owner cache". */
+ if (v->cargo_payment != NULL) v->cargo_payment->owner = NULL;
}
}
}