Fix SEGV in W'bal ridefilecache

.. when computing the distribution due to problems
   casting double to int for nan/inf values.
This commit is contained in:
Mark Liversedge
2015-06-15 22:00:01 +01:00
parent 997616546c
commit eff23d9bfb

View File

@@ -1353,12 +1353,12 @@ RideFileCache::computeDistribution(QVector<float> &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