]> granicus.if.org Git - icinga2/commitdiff
Fix crash in Checkable::ExecuteCheck
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 19 Apr 2016 07:35:48 +0000 (09:35 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 19 Apr 2016 07:37:04 +0000 (09:37 +0200)
fixes #11582

lib/icinga/checkable-check.cpp

index 6a3cd178b4bc01f638a2eb2168d81561b2131edd..1d5153d57f5930a03a3fea9f71984ed14af8482e 100644 (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);
                }