From 52ed451ae7875971dbf0b4aa5c1d6252af63fef8 Mon Sep 17 00:00:00 2001 From: greye Date: Sun, 17 Mar 2013 08:36:15 +0400 Subject: [PATCH] fix eraseStatic() assumptions --- apps/openmw/mwworld/store.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 20646e6dad..f69f606b45 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -192,11 +192,14 @@ namespace MWWorld if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { // delete from the static part of mShared typename std::vector::iterator sharedIter = mShared.begin(); - for (; sharedIter != (mShared.begin()+mStatic.size()); ++sharedIter) { + typename std::vector::iterator end = sharedIter + mStatic.size(); + + while (sharedIter != mShared.end() && sharedIter != end) { if((*sharedIter)->mId == item.mId) { mShared.erase(sharedIter); break; } + ++sharedIter; } mStatic.erase(it); }