mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 12:06:41 +00:00
fix eraseStatic() assumptions
This commit is contained in:
parent
83932ebfe8
commit
52ed451ae7
1 changed files with 4 additions and 1 deletions
|
@ -192,11 +192,14 @@ namespace MWWorld
|
||||||
if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) {
|
if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) {
|
||||||
// delete from the static part of mShared
|
// delete from the static part of mShared
|
||||||
typename std::vector<T *>::iterator sharedIter = mShared.begin();
|
typename std::vector<T *>::iterator sharedIter = mShared.begin();
|
||||||
for (; sharedIter != (mShared.begin()+mStatic.size()); ++sharedIter) {
|
typename std::vector<T *>::iterator end = sharedIter + mStatic.size();
|
||||||
|
|
||||||
|
while (sharedIter != mShared.end() && sharedIter != end) {
|
||||||
if((*sharedIter)->mId == item.mId) {
|
if((*sharedIter)->mId == item.mId) {
|
||||||
mShared.erase(sharedIter);
|
mShared.erase(sharedIter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
++sharedIter;
|
||||||
}
|
}
|
||||||
mStatic.erase(it);
|
mStatic.erase(it);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue