[icinga-checkins] icinga.org: icinga2/master: Fix crash in IdoCheckTask::ScriptFunc

git at icinga.org git at icinga.org
Tue Feb 2 12:03:37 CET 2016


Module: icinga2
Branch: master
Commit: f234bdd3211c94f1c08e1a260aa43e5fdca54999
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=f234bdd3211c94f1c08e1a260aa43e5fdca54999

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Tue Feb  2 12:03:12 2016 +0100

Fix crash in IdoCheckTask::ScriptFunc

refs #11014

---

 lib/db_ido/idochecktask.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp
index 92c82fc..a2cce81 100644
--- a/lib/db_ido/idochecktask.cpp
+++ b/lib/db_ido/idochecktask.cpp
@@ -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()) {



More information about the icinga-checkins mailing list