From 18f297a4e052b51d914e0158462021cda9602815 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Thu, 11 Mar 2021 20:37:38 +0100 Subject: [PATCH] Allow a missing implicit argument for GetDistance --- apps/openmw/mwscript/transformationextensions.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 825306d650..096e78d34b 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -42,10 +42,19 @@ namespace MWScript void execute (Interpreter::Runtime& runtime) override { - MWWorld::Ptr from = R()(runtime); + MWWorld::Ptr from = R()(runtime, !R::implicit); std::string name = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); + if (from.isEmpty()) + { + std::string error = "Missing implicit ref"; + runtime.getContext().report(error); + Log(Debug::Error) << error; + runtime.push(0.f); + return; + } + if (from.getContainerStore()) // is the object contained? { MWWorld::Ptr container = MWBase::Environment::get().getWorld()->findContainer(from);