From 18d317faf9fb31e052cfdf7a1d2e98227a3f62e9 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 5 Nov 2014 09:58:43 +0100 Subject: [PATCH] Fix crash in ApiEvents::CheckResultAPIHandler fixes #7577 --- lib/icinga/apievents.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp index aa6ecc3f0..d13276a5a 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(); - ObjectLock olock(vperf); - BOOST_FOREACH(const Value& vp, vperf) { - Value p; + if (vperf) { + ObjectLock olock(vperf); + BOOST_FOREACH(const Value& vp, vperf) { + Value p; - if (vp.IsObjectType()) { - PerfdataValue::Ptr val = make_shared(); - Deserialize(val, vp, true); - rperf->Add(val); - } else - rperf->Add(vp); + if (vp.IsObjectType()) { + PerfdataValue::Ptr val = make_shared(); + Deserialize(val, vp, true); + rperf->Add(val); + } else + rperf->Add(vp); + } } cr->SetPerformanceData(rperf);