From: Tobias Oetiker Date: Sat, 10 Nov 2012 16:46:44 +0000 (+0100) Subject: fix trendnan variable access X-Git-Tag: 1.4.8~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8381c9b92283b576929a7317f982a23d0b3254f3;p=thirdparty%2Frrdtool-1.x.git fix trendnan variable access --- diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c index b3d77601..78127d59 100644 --- a/src/rrd_rpncalc.c +++ b/src/rrd_rpncalc.c @@ -886,7 +886,9 @@ short rpn_calc( if (output_idx + 1 >= (int) ceil((float) dur / (float) step)) { int ignorenan = (rpnp[rpi].op == OP_TREND); double accum = 0.0; - int i = 0; + int i = -1; /* pick the current entries, not the next one + as the data pointer has already been forwarded + when the OP_VARIABLE was processed */ int count = 0; do {