]> granicus.if.org Git - icinga2/commitdiff
Fix crash when trying to set field on a value that is not an object
authorGunnar Beutner <gunnar@beutner.name>
Thu, 30 Jul 2015 06:28:07 +0000 (08:28 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 24 Aug 2015 11:26:35 +0000 (13:26 +0200)
fixes #9779

lib/config/vmops.hpp

index 96449c9c141ed95889f7e8381540c52c8d95c97a..1db10e0097ed8cb048a216a8edf2572ee770c081 100644 (file)
@@ -255,6 +255,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<Dictionary>(context);
 
                if (dict) {