Fix crash when a target in a different cell is (un)locked

This commit is contained in:
Capostrophic 2018-06-19 20:33:30 +03:00 committed by Capostrophic
parent 0731d79c09
commit 6c23caadd7

View file

@ -645,6 +645,7 @@ namespace MWMechanics
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId); const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
if (animation)
animation->addSpellCastGlow(magiceffect); animation->addSpellCastGlow(magiceffect);
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
{ {
@ -659,6 +660,7 @@ namespace MWMechanics
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId); const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
if (animation)
animation->addSpellCastGlow(magiceffect); animation->addSpellCastGlow(magiceffect);
if (target.getCellRef().getLockLevel() <= magnitude) if (target.getCellRef().getLockLevel() <= magnitude)
{ {