From: Michael Friedrich Date: Fri, 5 Jul 2013 09:32:19 +0000 (+0200) Subject: livestatus: hosttable: check if custom dictionary exists X-Git-Tag: v0.0.3~886 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b0c27acc52208977e1df5340746b5d38fd97822;p=icinga2 livestatus: hosttable: check if custom dictionary exists refs #4372 --- diff --git a/components/livestatus/hoststable.cpp b/components/livestatus/hoststable.cpp index 525f1f3cd..b98b54d71 100644 --- a/components/livestatus/hoststable.cpp +++ b/components/livestatus/hoststable.cpp @@ -263,6 +263,10 @@ Value HostsTable::CheckPeriodAccessor(const Object::Ptr& object) Value HostsTable::NotesAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("notes"); } @@ -275,6 +279,10 @@ Value HostsTable::NotesExpandedAccessor(const Object::Ptr& object) Value HostsTable::NotesUrlAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("notes_url"); } @@ -287,6 +295,10 @@ Value HostsTable::NotesUrlExpandedAccessor(const Object::Ptr& object) Value HostsTable::ActionUrlAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("action_url"); } @@ -323,6 +335,10 @@ Value HostsTable::PerfDataAccessor(const Object::Ptr& object) Value HostsTable::IconImageAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("icon_image"); } @@ -335,12 +351,20 @@ Value HostsTable::IconImageExpandedAccessor(const Object::Ptr& object) Value HostsTable::IconImageAltAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("icon_image_alt"); } Value HostsTable::StatusmapImageAccessor(const Object::Ptr& object) { Dictionary::Ptr custom = static_pointer_cast(object)->GetCustom(); + + if (!custom) + return Value(); + return custom->Get("statusmap_image"); }