Fix crash in Checkable::ExecuteCheck

fixes #11582
This commit is contained in:
Gunnar Beutner 2016-04-19 09:35:48 +02:00
parent cfafaee5b0
commit d4b5ada951
1 changed files with 10 additions and 2 deletions

View File

@ -476,8 +476,16 @@ void Checkable::ExecuteCheck(void)
/* fail to perform check on unconnected endpoint */
cr->SetState(ServiceUnknown);
cr->SetOutput("Remote Icinga instance '" + endpoint->GetName() +
"' " + "is not connected to '" + Endpoint::GetLocalEndpoint()->GetName() + "'");
String output = "Remote Icinga instance '" + endpoint->GetName() + "' is not connected to ";
Endpoint::Ptr localEndpoint = Endpoint::GetLocalEndpoint();
if (localEndpoint)
output += "'" + localEndpoint->GetName() + "'";
else
output += "this instance";
cr->SetOutput(output);
ProcessCheckResult(cr);
}