diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 0fb525464..1e1cb78cf 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -81,21 +81,30 @@ void Notification::OnConfigLoaded(void) SetTypeFilter(FilterArrayToInt(GetTypes(), ~0)); SetStateFilter(FilterArrayToInt(GetStates(), ~0)); - GetCheckable()->AddNotification(GetSelf()); + Checkable::Ptr obj = GetCheckable(); + + if (obj) + obj->AddNotification(GetSelf()); } void Notification::Start(void) { DynamicObject::Start(); - GetCheckable()->AddNotification(GetSelf()); + Checkable::Ptr obj = GetCheckable(); + + if (obj) + obj->AddNotification(GetSelf()); } void Notification::Stop(void) { DynamicObject::Stop(); - GetCheckable()->RemoveNotification(GetSelf()); + Checkable::Ptr obj = GetCheckable(); + + if (obj) + obj->RemoveNotification(GetSelf()); } Checkable::Ptr Notification::GetCheckable(void) const