From 17ebebf268fc2d8849344ef6d5ff4772f3eea796 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Thu, 6 Aug 2015 12:53:41 +0300 Subject: [PATCH] API: When combining histogram, return zeroed histogram on empty This change make sure that when there are no results (ie. all the histogram that are summed are empty) the return result will be a zerroed histogram and not an empty object. Signed-off-by: Amnon Heiman --- api/api.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/api.hh b/api/api.hh index 65efc9d3b6..7f85da252e 100644 --- a/api/api.hh +++ b/api/api.hh @@ -111,13 +111,13 @@ inline double pow2(double a) { inline httpd::utils_json::histogram add_histogram(httpd::utils_json::histogram res, const utils::ihistogram& val) { - if (val.count == 0) { - return res; - } if (!res.count._set) { res = val; return res; } + if (val.count == 0) { + return res; + } if (res.min() > val.min) { res.min = val.min; }