From c6a015e3172939289443e7aad3d1117393a0a195 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 19 Apr 2016 09:35:48 +0200 Subject: [PATCH] Fix crash in Checkable::ExecuteCheck fixes #11582 --- lib/icinga/checkable-check.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 6a3cd178b..1d5153d57 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -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); } -- 2.40.0