From 84e6aa2d98c0f7bf97f3a1eda675b9c700c2fd05 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 2 Aug 2011 02:05:32 +0100 Subject: [PATCH] Fix crash on 'dodgy' .man file in v3 This is a fix for bug 205 which is registered against v2.1 but is also present in v3. This fix will not be relevant for v2.1 since the cpi file has been replaced with the cpx file. --- src/RideFileCache.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/RideFileCache.cpp b/src/RideFileCache.cpp index 7c3b0087c..121486bda 100644 --- a/src/RideFileCache.cpp +++ b/src/RideFileCache.cpp @@ -558,6 +558,10 @@ MeanMaxComputer::run() double secs = round(p->secs * 1000.0) / 1000; if (secs > 0) data.points.append(cpintpoint(secs, (int) round(p->value(baseSeries)))); } + + // don't bother with insufficient data + if (!data.points.count()) return; + int total_secs = (int) ceil(data.points.back().secs); // don't allow data more than two days