From: Gunnar Beutner Date: Thu, 30 Jul 2015 06:28:07 +0000 (+0200) Subject: Fix crash when trying to set field on a value that is not an object X-Git-Tag: v2.4.0~466 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1634dbc6e46fe3b332c43259af54bdb8291655a9;p=icinga2 Fix crash when trying to set field on a value that is not an object fixes #9779 --- 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) {