Remove active effects from spells that no longer exist

pull/3169/head
Evil Eye 3 years ago
parent 7af245d205
commit 3d5950f790

@ -1,5 +1,7 @@
#include "activespells.hpp"
#include <components/debug/debuglog.hpp>
#include <components/misc/rng.hpp>
#include <components/misc/stringops.hpp>
@ -234,7 +236,17 @@ namespace MWMechanics
bool remove = false;
if(spellIt->mType == ESM::ActiveSpells::Type_Ability || spellIt->mType == ESM::ActiveSpells::Type_Permanent)
remove = !spells.hasSpell(spellIt->mId);
{
try
{
remove = !spells.hasSpell(spellIt->mId);
}
catch(const std::runtime_error& e)
{
remove = true;
Log(Debug::Error) << "Removing active effect: " << e.what();
}
}
else if(spellIt->mType == ESM::ActiveSpells::Type_Enchantment)
{
const auto& store = ptr.getClass().getInventoryStore(ptr);

Loading…
Cancel
Save