From: Gunnar Beutner Date: Wed, 10 Jul 2013 07:57:18 +0000 (+0200) Subject: Fix nullptr deref in Service::GetLastCheckPerfData(). X-Git-Tag: v0.0.3~870 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=664916dffb0307d3e6a709fd636fbedbe3f8b409;p=icinga2 Fix nullptr deref in Service::GetLastCheckPerfData(). --- diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index f6ea3092f..57e805bf0 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -301,9 +301,13 @@ String Service::GetLastCheckLongOutput(void) const String Service::GetLastCheckPerfData(void) const { Dictionary::Ptr cr = GetLastCheckResult(); - String perfdata = cr->Get("performance_data_raw"); + String perfdata; - boost::algorithm::replace_all(perfdata, "\n", "\\n"); + if (cr) { + perfdata = cr->Get("performance_data_raw"); + + boost::algorithm::replace_all(perfdata, "\n", "\\n"); + } return perfdata; }