Fix nullptr deref in Service::GetLastCheckPerfData().

This commit is contained in:
Gunnar Beutner 2013-07-10 09:57:18 +02:00
parent 540489e408
commit 664916dffb
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}