mirror of https://github.com/Icinga/icinga2.git
Fix crash when trying to set field on a value that is not an object
fixes #9779
This commit is contained in:
parent
a82c65692c
commit
1634dbc6e4
|
@ -287,6 +287,9 @@ public:
|
||||||
|
|
||||||
static inline void SetField(const Object::Ptr& context, const String& field, const Value& value, const DebugInfo& debugInfo = DebugInfo())
|
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);
|
Dictionary::Ptr dict = dynamic_pointer_cast<Dictionary>(context);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
|
|
Loading…
Reference in New Issue