(svn r21679) -Fix (r21642): reading a just freed variable

This commit is contained in:
rubidium 2010-12-31 15:53:46 +00:00
parent 582472d626
commit 64c7cc51b5

View File

@ -1747,9 +1747,10 @@ void Vehicle::BeginLoading()
current_order.MakeLoading(true); current_order.MakeLoading(true);
UpdateVehicleTimetable(this, true); UpdateVehicleTimetable(this, true);
for (Order *order = this->GetOrder(this->cur_order_index); const Order *order = this->GetOrder(this->cur_order_index);
order != NULL && order->IsType(OT_AUTOMATIC); while (order != NULL && order->IsType(OT_AUTOMATIC)) {
order = order->next) { /* Delete order effectively deletes order, so get the next before deleting it. */
order = order->next;
DeleteOrder(this, this->cur_order_index); DeleteOrder(this, this->cur_order_index);
} }