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:
parent
a4d0068e29
commit
140013820b
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user