]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Treat NaN values properly in graph command
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 1 Jul 2016 16:36:33 +0000 (17:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 1 Jul 2016 16:36:33 +0000 (17:36 +0100)
src/controller.c

index 8fb3cb1b11b5c87e97154fc2eaa784465d0a4d5f..bee46adceb4cf19f65e898abe40d813ef58708bf 100644 (file)
@@ -1042,7 +1042,8 @@ rspamd_controller_handle_graph (
        struct rspamd_controller_worker_ctx *ctx;
        rspamd_ftok_t srch, *value;
        struct rspamd_rrd_query_result *rrd_result;
-       gulong i, j, ts, start_row, cnt, t;
+       gulong i, j, start_row, cnt, t, ts;
+       gdouble yval, last = 0;
        ucl_object_t *res, *elt[4], *data_elt;
        enum {
                rra_hourly = 0,
@@ -1126,7 +1127,6 @@ rspamd_controller_handle_graph (
 
        for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; cnt ++) {
                for (j = 0; j < rrd_result->ds_count; j++) {
-                       gdouble yval;
 
                        data_elt = ucl_object_typed_new (UCL_OBJECT);
                        t = ts * rrd_result->pdp_per_cdp;
@@ -1141,10 +1141,11 @@ rspamd_controller_handle_graph (
                                                ucl_object_fromdouble (yval),
                                                "y", 1,
                                                false);
+                               last = yval;
                        }
                        else {
                                ucl_object_insert_key (data_elt,
-                                               ucl_object_typed_new (UCL_NULL),
+                                               ucl_object_fromdouble (last),
                                                "y", 1,
                                                false);
                        }