diff --git a/apps/openmw/mwlua/objectbindings.cpp b/apps/openmw/mwlua/objectbindings.cpp index 386e0b913b..ec33a3dc4e 100644 --- a/apps/openmw/mwlua/objectbindings.cpp +++ b/apps/openmw/mwlua/objectbindings.cpp @@ -502,6 +502,10 @@ namespace MWLua }; objectT["setTransform"] = [context](const GObject& object, const osg::Vec3f& newPos, const sol::object& newRotObj, sol::optional terrainClampOpt) { + if (newRotObj == sol::nil) + { + throw std::runtime_error("setTransform requires a non-nil rotation argument"); + } bool terrainClamp = terrainClampOpt.value_or(true); MWWorld::Ptr ptr = object.ptr(); if (ptr.getCellRef().getCount() == 0 || !ptr.isInCell()) @@ -562,6 +566,10 @@ namespace MWLua "SetPositionAction"); }; objectT["setRotation"] = [context](const GObject& object, const sol::object& newRotObj) { + if (newRotObj == sol::nil) + { + throw std::runtime_error("setTransform requires a non-nil rotation argument"); + } MWWorld::Ptr ptr = object.ptr(); if (ptr.getCellRef().getCount() == 0 || !ptr.isInCell()) throw std::runtime_error("Object is either removed or in the process of teleporting");