]> 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>
Thu, 30 Jul 2015 06:28:07 +0000 (08:28 +0200)
fixes #9779

lib/config/vmops.hpp

index a6e26199a2d0ed56fc5e6764a11891d1e62e34f6..e7827492ff47883765d782efea40d62d744b618f 100644 (file)
@@ -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<Dictionary>(context);
 
                if (dict) {