mirror of https://github.com/Icinga/icinga2.git
compat: Make sure host is not null.
This commit is contained in:
parent
42dcd854fb
commit
ed28ae1b3f
|
@ -195,12 +195,16 @@ void CompatComponent::CommandPipeThread(const String& commandPath)
|
||||||
void CompatComponent::DumpComments(std::ostream& fp, const Service::Ptr& owner, CompatObjectType type)
|
void CompatComponent::DumpComments(std::ostream& fp, const Service::Ptr& owner, CompatObjectType type)
|
||||||
{
|
{
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
Host::Ptr host;
|
|
||||||
Dictionary::Ptr comments = owner->GetComments();
|
Dictionary::Ptr comments = owner->GetComments();
|
||||||
|
|
||||||
if (!comments)
|
if (!comments)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Host::Ptr host = owner->GetHost();
|
||||||
|
|
||||||
|
if (!host)
|
||||||
|
return;
|
||||||
|
|
||||||
ObjectLock olock(comments);
|
ObjectLock olock(comments);
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
|
@ -215,7 +219,7 @@ void CompatComponent::DumpComments(std::ostream& fp, const Service::Ptr& owner,
|
||||||
fp << "servicecomment {" << "\n"
|
fp << "servicecomment {" << "\n"
|
||||||
<< "\t" << "service_description=" << owner->GetShortName() << "\n";
|
<< "\t" << "service_description=" << owner->GetShortName() << "\n";
|
||||||
|
|
||||||
fp << "\t" << "host_name=" << owner->GetHost()->GetName() << "\n"
|
fp << "\t" << "host_name=" << host->GetName() << "\n"
|
||||||
<< "\t" << "comment_id=" << static_cast<String>(comment->Get("legacy_id")) << "\n"
|
<< "\t" << "comment_id=" << static_cast<String>(comment->Get("legacy_id")) << "\n"
|
||||||
<< "\t" << "entry_time=" << static_cast<double>(comment->Get("entry_time")) << "\n"
|
<< "\t" << "entry_time=" << static_cast<double>(comment->Get("entry_time")) << "\n"
|
||||||
<< "\t" << "entry_type=" << static_cast<long>(comment->Get("entry_type")) << "\n"
|
<< "\t" << "entry_type=" << static_cast<long>(comment->Get("entry_type")) << "\n"
|
||||||
|
|
Loading…
Reference in New Issue