1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Merge branch 'catch_me' into 'master'

Remove active effects from spells that no longer exist

See merge request OpenMW/openmw!1273
This commit is contained in:
psi29a 2021-10-11 08:53:48 +00:00
commit 3e2694dde9

View File

@ -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);