diff --git a/src/RideFile.cpp b/src/RideFile.cpp index 05c9acec6e..9ef70380c6 100644 --- a/src/RideFile.cpp +++ b/src/RideFile.cpp @@ -2124,21 +2124,28 @@ RideFile::recalculateDerivedSeries(bool force) ctArray[i] = x; } - // now update the RideFile data points - int index=0; - foreach(RideFilePoint *p, dataPoints_) { - - // move on to the next one - if (double(index)*60.0f < p->secs && index < (ctArray.count()-1)) index++; - - // just use the current value first for index=0 and p->secs=0 - p->tcore = ctArray[index]; + // now update the RideFile data points, but only if we got + // any data i.e. ride is longer than a minute long! + if (ctArray.count()) { + int index=0; + foreach(RideFilePoint *p, dataPoints_) { + + // move on to the next one + if (double(index)*60.0f < p->secs && index < (ctArray.count()-1)) index++; + + // just use the current value first for index=0 and p->secs=0 + p->tcore = ctArray[index]; + + // smooth the values + //if (index && p->secs > 0 && p->secs <= (double(index)*60.0f)) { + //double pt = (p->secs - (double(index-1)*60.00f)) / 60.0f; + //p->tcore = (ctArray[index] - ctArray[index-1]) * pt; + //} + } + } else { - // smooth the values - //if (index && p->secs > 0 && p->secs <= (double(index)*60.0f)) { - //double pt = (p->secs - (double(index-1)*60.00f)) / 60.0f; - //p->tcore = (ctArray[index] - ctArray[index-1]) * pt; - //} + // just set to the starting body temperature for every point + foreach(RideFilePoint *p, dataPoints_) p->tcore = CTStart; } }