Skip to content

Commit

Permalink
Fix Core Temp SEGV
Browse files Browse the repository at this point in the history
.. importing ride < 60s long

Fixes #1411
  • Loading branch information
liversedge committed Jun 21, 2015
1 parent d46801f commit 2222d1d
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/RideFile.cpp
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 2222d1d

Please sign in to comment.