diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/base/ship.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index cc583d9..b1e0574 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -450,6 +450,7 @@ void Ship::explode() if ((*it)->info()->type() == Cargo::infotype()) { long loss = (*it)->amount() * ((long) percentage) / 100l; if (loss > 0) { + // eject potentially deletes the item the iterator is pointing to eject((*it++), loss, false); continue; } @@ -463,7 +464,9 @@ void Ship::explode() while (it != inventory()->items().end()) { if ((*it)->info()->type() == Weapon::infotype()) { if (math::randomf(100.0f) < 10.0f) { - eject((*it++), (*it)->amount(), false); + // eject potentially deletes the item the iterator is pointing to + float amount = (*it)->amount(); + eject((*it++), amount, false); continue; } } |