From 1634dbc6e46fe3b332c43259af54bdb8291655a9 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 30 Jul 2015 08:28:07 +0200 Subject: [PATCH] Fix crash when trying to set field on a value that is not an object fixes #9779 --- lib/config/vmops.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index a6e26199a..e7827492f 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -287,6 +287,9 @@ public: static inline void SetField(const Object::Ptr& context, const String& field, const Value& value, const DebugInfo& debugInfo = DebugInfo()) { + if (!context) + BOOST_THROW_EXCEPTION(ScriptError("Cannot set field '" + field + "' on a value that is not an object.", debugInfo)); + Dictionary::Ptr dict = dynamic_pointer_cast(context); if (dict) { -- 2.40.0