Mercurial > hg > openttd
changeset 16944:b0c943e6f39f draft
(svn r21679) -Fix (r21642): reading a just freed variable
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 31 Dec 2010 15:53:46 +0000 |
parents | e2c807283ac2 |
children | 32309494f10d |
files | src/vehicle.cpp |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1747,9 +1747,10 @@ current_order.MakeLoading(true); UpdateVehicleTimetable(this, true); - for (Order *order = this->GetOrder(this->cur_order_index); - order != NULL && order->IsType(OT_AUTOMATIC); - order = order->next) { + const Order *order = this->GetOrder(this->cur_order_index); + while (order != NULL && order->IsType(OT_AUTOMATIC)) { + /* Delete order effectively deletes order, so get the next before deleting it. */ + order = order->next; DeleteOrder(this, this->cur_order_index); }