]> granicus.if.org Git - icinga2/commitdiff
livestatus: hosttable: check if custom dictionary exists
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 5 Jul 2013 09:32:19 +0000 (11:32 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 5 Jul 2013 09:32:19 +0000 (11:32 +0200)
refs #4372

components/livestatus/hoststable.cpp

index 525f1f3cd7484a7bdc681471a3d6173e9f332e43..b98b54d712ac225de65c37e7a1e8c14aca766d23 100644 (file)
@@ -263,6 +263,10 @@ Value HostsTable::CheckPeriodAccessor(const Object::Ptr& object)
 Value HostsTable::NotesAccessor(const Object::Ptr& object)
 {
        Dictionary::Ptr custom = static_pointer_cast<Host>(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<Host>(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<Host>(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<Host>(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<Host>(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<Host>(object)->GetCustom();
+
+       if (!custom)
+               return Value();
+
        return custom->Get("statusmap_image");
 }