mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 22:24:44 +02:00
Fix crash when trying to set field on a value that is not an object
fixes #9779
This commit is contained in:
parent
b1d7bf9dde
commit
e9c2214837
@ -255,6 +255,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…
x
Reference in New Issue
Block a user