diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 586e407ff..20646e6da 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -187,18 +187,17 @@ namespace MWWorld T item; item.mId = Misc::StringUtils::lowerCase(id); - // delete from the static part of mShared - typename std::vector::iterator sharedIter = mShared.begin(); - for (; sharedIter != (mShared.begin()+mStatic.size()); ++sharedIter) { - if((*sharedIter)->mId == item.mId) { - mShared.erase(sharedIter); - break; - } - } - typename std::map::iterator it = mStatic.find(item.mId); 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) { + if((*sharedIter)->mId == item.mId) { + mShared.erase(sharedIter); + break; + } + } mStatic.erase(it); }