Fix Polar ride parser crash

Tacx HRM exporter does not create an [IntTimes] section.
When the [HRDate] section is encountered, This patch creates
a single interval in the intervals list, which has the
length of the complete ride.

Fixes #23
This commit is contained in:
Ilja Booij
2010-09-08 09:31:15 +02:00
committed by Mark Liversedge
parent 87a6f9e628
commit f6b5cd2790

View File

@@ -94,8 +94,13 @@ RideFile *PolarFileReader::openRideFile(QFile &file, QStringList &errors) const
else if (line.startsWith("[")) {
//fprintf(stderr, "section : %s\n", line.toAscii().constData());
section=line;
if (section == "[HRData]")
if (section == "[HRData]") {
// Some systems, like the Tacx HRM exporter, do not add an [IntTimes] section, so we need to
// specify that the whole ride is one big interval.
if (intervals.isEmpty())
intervals.append(seconds);
next_interval = intervals.at(0);
}
}
else if (section == "[Params]"){
if (line.contains("Version=")) {