1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Fix invalidated iterator

This commit is contained in:
MiroslavR 2014-11-02 15:40:08 +01:00
parent a4d0068e29
commit 140013820b

View File

@ -70,11 +70,13 @@ namespace MWMechanics
if (mPermanentSpellEffects.find(lower) != mPermanentSpellEffects.end())
{
MagicEffects & effects = mPermanentSpellEffects[lower];
for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end(); ++effectIt)
for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end();)
{
const ESM::MagicEffect * magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectIt->first.mId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
effects.remove(effectIt->first);
effects.remove((effectIt++)->first);
else
++effectIt;
}
}
mCorprusSpells.erase(corprusIt);