From f6b5cd2790b3decc58b001bb7cdf30b722ae3226 Mon Sep 17 00:00:00 2001 From: Ilja Booij Date: Wed, 8 Sep 2010 09:31:15 +0200 Subject: [PATCH] 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 --- src/PolarRideFile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PolarRideFile.cpp b/src/PolarRideFile.cpp index b32f03f51..7ec6645bf 100644 --- a/src/PolarRideFile.cpp +++ b/src/PolarRideFile.cpp @@ -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=")) {