]> granicus.if.org Git - icinga2/commitdiff
Fix crash in IdoCheckTask::ScriptFunc
authorGunnar Beutner <gunnar@beutner.name>
Tue, 2 Feb 2016 11:03:12 +0000 (12:03 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 2 Feb 2016 11:03:12 +0000 (12:03 +0100)
refs #11014

lib/db_ido/idochecktask.cpp

index 92c82fcc997aa9c6fa8a9ecea4a23a6e774a6408..a2cce81722d604b3c01c3423517f72eab8806c97 100644 (file)
@@ -92,6 +92,13 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
 
        DbConnection::Ptr conn = static_pointer_cast<DbConnection>(dtype->GetObject(idoName));
 
+       if (!conn) {
+               cr->SetOutput("IDO connection '" + idoName + "' does not exist.");
+               cr->SetState(ServiceUnknown);
+               checkable->ProcessCheckResult(cr);
+               return;
+       }
+
        double qps = conn->GetQueryCount(60) / 60.0;
 
        if (!conn->GetConnected()) {