srm interval end bug fix

If the user forgot to end an interval before downloading a ride, GC
would crash due to an assertion failure.  The included ride file
demonstrates the bug.
This commit is contained in:
Sean Rhea
2009-12-22 14:49:03 -05:00
parent 32b94d954f
commit 9b4782ab98
2 changed files with 2 additions and 1 deletions

View File

@@ -235,7 +235,8 @@ RideFile *SrmFileReader::openRideFile(QFile &file, QStringList &errorStrings) co
for (int i = 1; i < markers.size(); ++i) {
const marker &marker = markers[i];
double start_secs = result->dataPoints()[marker.start]->secs;
double end_secs = result->dataPoints()[marker.end]->secs + result->recIntSecs();
int end = qMin(marker.end, result->dataPoints().size() - 1);
double end_secs = result->dataPoints()[end]->secs + result->recIntSecs();
result->addInterval(last, start_secs, "");
result->addInterval(start_secs, end_secs, QString("%1").arg(i));
last = end_secs;