From 5d3307cafa04f8bd1fa56ab38095fcf8c52dafcf Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 10 Feb 2017 09:33:41 +0000 Subject: [PATCH] Fix FIT export SEGV on manual rides .. or rides which contain no datapoints. --- src/FileIO/FitRideFile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FileIO/FitRideFile.cpp b/src/FileIO/FitRideFile.cpp index 5017a078b..ec6dfa9b5 100644 --- a/src/FileIO/FitRideFile.cpp +++ b/src/FileIO/FitRideFile.cpp @@ -3132,9 +3132,10 @@ void write_activity(QByteArray *array, const RideFile *ride) { value = 1; write_int8(array, value); - value = ride->startTime().toTime_t() + ride->dataPoints().last()->secs; - write_int32(array, value, true); - + if (ride->dataPoints().last()) { + value = ride->startTime().toTime_t() + ride->dataPoints().last()->secs; + write_int32(array, value, true); + } } void write_record(QByteArray *array, const RideFile *ride, bool withAlt, bool withWatts, bool withHr, bool withCad ) {