From eb363c3fab01bdcbde19b0ed4377764bbd62380d Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 24 Apr 2018 10:07:54 +0100 Subject: [PATCH] Fix Swim FIT parse crash .. not checking timeIndex() for out of bounds when secs goes negative during parsing. .. also, enable interpolation for swim laps by default to ensure no data loss (i.e. don't insist on garmin smart recording setting). Fixes #2953 --- src/FileIO/FitRideFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FileIO/FitRideFile.cpp b/src/FileIO/FitRideFile.cpp index 062671a7d..c1481d456 100644 --- a/src/FileIO/FitRideFile.cpp +++ b/src/FileIO/FitRideFile.cpp @@ -1346,7 +1346,7 @@ struct FitFileReaderState // s.t. Garmin 910xt double secs = time - start_time; if ((total_distance == 0.0) && (secs > last_time + 1) && - (isGarminSmartRecording.toInt() != 0) && + //(isGarminSmartRecording.toInt() != 0) && // always do this for swim laps (secs - last_time < 100*GarminHWM.toInt())) { double deltaSecs = secs - last_time; for (int i = 1; i <= deltaSecs; i++) { @@ -2154,7 +2154,7 @@ struct FitFileReaderState if (secs>0) { int idx = rideFile->timeIndex(round(secs)); - if (rideFile->dataPoints().at(idx)->secs==secs) + if (idx < 0 || rideFile->dataPoints().at(idx)->secs==secs) rideFile->appendOrUpdatePoint( secs, 0.0, hr.at(i), 0.0,