mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22582) -Fix: Don't increment STL iterators after they've been invalidated.
This commit is contained in:
parent
b32a8d11c3
commit
56b7faed52
|
@ -218,7 +218,7 @@ void CargoList<Tinst>::Truncate(uint max_remaining)
|
||||||
CargoPacket *cp = *it;
|
CargoPacket *cp = *it;
|
||||||
if (max_remaining == 0) {
|
if (max_remaining == 0) {
|
||||||
/* Nothing should remain, just remove the packets. */
|
/* Nothing should remain, just remove the packets. */
|
||||||
this->packets.erase(it++);
|
it = this->packets.erase(it);
|
||||||
static_cast<Tinst *>(this)->RemoveFromCache(cp);
|
static_cast<Tinst *>(this)->RemoveFromCache(cp);
|
||||||
delete cp;
|
delete cp;
|
||||||
continue;
|
continue;
|
||||||
|
@ -278,7 +278,7 @@ bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta
|
||||||
if (cp->count <= max_move) {
|
if (cp->count <= max_move) {
|
||||||
/* Can move the complete packet */
|
/* Can move the complete packet */
|
||||||
max_move -= cp->count;
|
max_move -= cp->count;
|
||||||
this->packets.erase(it++);
|
it = this->packets.erase(it);
|
||||||
static_cast<Tinst *>(this)->RemoveFromCache(cp);
|
static_cast<Tinst *>(this)->RemoveFromCache(cp);
|
||||||
switch (mta) {
|
switch (mta) {
|
||||||
case MTA_FINAL_DELIVERY:
|
case MTA_FINAL_DELIVERY:
|
||||||
|
|
Loading…
Reference in New Issue