summaryrefslogtreecommitdiff
path: root/src/cargopacket.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-06-13 10:46:00 +0000
committermichi_cc <michi_cc@openttd.org>2011-06-13 10:46:00 +0000
commit56b7faed5238a84bd80732bf157c040d3cef790e (patch)
treefe10415edc486579cf66f5feaca42710c9256ab6 /src/cargopacket.cpp
parentb32a8d11c3d66730d7365c30b3643d1a77159665 (diff)
downloadopenttd-56b7faed5238a84bd80732bf157c040d3cef790e.tar.xz
(svn r22582) -Fix: Don't increment STL iterators after they've been invalidated.
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r--src/cargopacket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index 2c93d8c85..8bd6b651d 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -218,7 +218,7 @@ void CargoList<Tinst>::Truncate(uint max_remaining)
CargoPacket *cp = *it;
if (max_remaining == 0) {
/* Nothing should remain, just remove the packets. */
- this->packets.erase(it++);
+ it = this->packets.erase(it);
static_cast<Tinst *>(this)->RemoveFromCache(cp);
delete cp;
continue;
@@ -278,7 +278,7 @@ bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta
if (cp->count <= max_move) {
/* Can move the complete packet */
max_move -= cp->count;
- this->packets.erase(it++);
+ it = this->packets.erase(it);
static_cast<Tinst *>(this)->RemoveFromCache(cp);
switch (mta) {
case MTA_FINAL_DELIVERY: