Fix empty perf data strings

This commit is contained in:
Jean Flach 2018-12-03 17:23:40 +01:00 committed by Michael Friedrich
parent 446796dadb
commit e90fb43b91
1 changed files with 4 additions and 2 deletions

View File

@ -677,8 +677,10 @@ Dictionary::Ptr RedisWriter::SerializeState(const Checkable::Ptr& checkable)
}
}
if (cr->GetPerformanceData())
attrs->Set("performance_data", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
String perfData = PluginUtility::FormatPerfdata(cr->GetPerformanceData());
if (!perfData.IsEmpty())
attrs->Set("performance_data", perfData);
if (!cr->GetCommand().IsEmpty())
attrs->Set("commandline", FormatCommandLine(cr->GetCommand()));
attrs->Set("execution_time", cr->CalculateExecutionTime());