From e7bf1d230ccf6ec08e01b5ef813d0b98adbc2dc9 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 27 Apr 2013 16:22:04 +0200 Subject: [PATCH] fixed an indexing problem in IdCollection --- apps/opencs/model/world/idcollection.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index 7761929f3f..e65f11cef5 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -278,9 +278,15 @@ namespace CSMWorld template void IdCollection::purge() { - mRecords.erase (std::remove_if (mRecords.begin(), mRecords.end(), - std::mem_fun_ref (&Record::isErased) // I want lambda :( - ), mRecords.end()); + int i = 0; + + while (i (mRecords.size())) + { + if (mRecords[i].isErased()) + removeRows (i, 1); + else + ++i; + } } template