From c91d1e73942492950bd98639e4530faf7da36c1b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 4 May 2019 14:09:52 +0400 Subject: [PATCH] Ignore containers without resolved content for Detect spells --- apps/openmw/mwworld/worldimp.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 1aac737c3a..cd03137d7e 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3335,9 +3335,13 @@ namespace MWWorld return true; // Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers) - if (mType != World::Detect_Creature && - (ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name())) + bool isContainer = ptr.getClass().getTypeName() == typeid(ESM::Container).name(); + if (mType != World::Detect_Creature && (ptr.getClass().isActor() || isContainer)) { + // but ignore containers without resolved content + if (isContainer && ptr.getRefData().getCustomData() == nullptr) + return true; + MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr); { for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)