From eff23d9bfb73d73e46e55aea57ac202c948d686d Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 15 Jun 2015 22:00:01 +0100 Subject: [PATCH] Fix SEGV in W'bal ridefilecache .. when computing the distribution due to problems casting double to int for nan/inf values. --- src/RideFileCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RideFileCache.cpp b/src/RideFileCache.cpp index ceebc8eb6..bfb5eb202 100644 --- a/src/RideFileCache.cpp +++ b/src/RideFileCache.cpp @@ -1353,12 +1353,12 @@ RideFileCache::computeDistribution(QVector &array, RideFile::SeriesType s foreach(int value, ride->wprimeData()->ydata()) { // percent is PERCENT OF W' USED - double percent = 100.0f - ((double (value) / WPRIME) * 100.0f); + int percent = 100.0f - ((double (value) / WPRIME) * 100.0f); if (percent < 0.0f) percent = 0.0f; if (percent > 100.0f) percent = 100.0f; // increment counts - array[(int)percent]++; + array[percent]++; count++; // and zones in 1s increments