Fix exception for Notification objects without checkable object.

Fixes #6111
This commit is contained in:
Michael Friedrich 2014-05-02 19:43:49 +02:00
parent 07c0c9e234
commit dbe6a20fd2

View File

@ -81,21 +81,30 @@ void Notification::OnConfigLoaded(void)
SetTypeFilter(FilterArrayToInt(GetTypes(), ~0)); SetTypeFilter(FilterArrayToInt(GetTypes(), ~0));
SetStateFilter(FilterArrayToInt(GetStates(), ~0)); SetStateFilter(FilterArrayToInt(GetStates(), ~0));
GetCheckable()->AddNotification(GetSelf()); Checkable::Ptr obj = GetCheckable();
if (obj)
obj->AddNotification(GetSelf());
} }
void Notification::Start(void) void Notification::Start(void)
{ {
DynamicObject::Start(); DynamicObject::Start();
GetCheckable()->AddNotification(GetSelf()); Checkable::Ptr obj = GetCheckable();
if (obj)
obj->AddNotification(GetSelf());
} }
void Notification::Stop(void) void Notification::Stop(void)
{ {
DynamicObject::Stop(); DynamicObject::Stop();
GetCheckable()->RemoveNotification(GetSelf()); Checkable::Ptr obj = GetCheckable();
if (obj)
obj->RemoveNotification(GetSelf());
} }
Checkable::Ptr Notification::GetCheckable(void) const Checkable::Ptr Notification::GetCheckable(void) const