[icinga-checkins] icinga.org: icinga2/master: Fix crash in ApiEvents::CheckResultAPIHandler

git at icinga.org git at icinga.org
Wed Nov 5 09:58:54 CET 2014


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Nov  5 09:58:43 2014 +0100

Fix crash in ApiEvents::CheckResultAPIHandler

fixes #7577

---

 lib/icinga/apievents.cpp |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp
index aa6ecc3..d13276a 100644
--- a/lib/icinga/apievents.cpp
+++ b/lib/icinga/apievents.cpp
@@ -144,16 +144,18 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
 
 	Array::Ptr rperf = make_shared<Array>();
 
-	ObjectLock olock(vperf);
-	BOOST_FOREACH(const Value& vp, vperf) {
-		Value p;
-
-		if (vp.IsObjectType<Dictionary>()) {
-			PerfdataValue::Ptr val = make_shared<PerfdataValue>();
-			Deserialize(val, vp, true);
-			rperf->Add(val);
-		} else
-			rperf->Add(vp);
+	if (vperf) {
+		ObjectLock olock(vperf);
+		BOOST_FOREACH(const Value& vp, vperf) {
+			Value p;
+
+			if (vp.IsObjectType<Dictionary>()) {
+				PerfdataValue::Ptr val = make_shared<PerfdataValue>();
+				Deserialize(val, vp, true);
+				rperf->Add(val);
+			} else
+				rperf->Add(vp);
+		}
 	}
 
 	cr->SetPerformanceData(rperf);



More information about the icinga-checkins mailing list