diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 3822a247bd..9708a503ee 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -189,11 +189,17 @@ namespace MWScript public: void execute(Interpreter::Runtime& runtime) override { - MWWorld::Ptr ptr = R()(runtime); + MWWorld::Ptr ptr = R()(runtime, false); ESM::RefId item = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger)); runtime.pop(); + if (ptr.isEmpty() || (ptr.getType() != ESM::Container::sRecordId && !ptr.getClass().isActor())) + { + runtime.push(0); + return; + } + if (item == "gold_005" || item == "gold_010" || item == "gold_025" || item == "gold_100") item = MWWorld::ContainerStore::sGoldId;