From 065a3886325cba7877aa4532939236b43e855d2e Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 5 Apr 2025 00:27:43 +0300 Subject: [PATCH] Allow enchantments to be missing on equipped items --- apps/openmw/mwmechanics/activespells.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 3cee16f29f..9e64996e46 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -289,8 +289,9 @@ namespace MWMechanics const ESM::RefId& enchantmentId = slot->getClass().getEnchantment(*slot); if (enchantmentId.empty()) continue; - const ESM::Enchantment* enchantment = world->getStore().get().find(enchantmentId); - if (enchantment->mData.mType != ESM::Enchantment::ConstantEffect) + const ESM::Enchantment* enchantment + = world->getStore().get().search(enchantmentId); + if (enchantment == nullptr || enchantment->mData.mType != ESM::Enchantment::ConstantEffect) continue; if (std::find_if(mSpells.begin(), mSpells.end(), [&](const ActiveSpellParams& params) {