SportTracks download - ensure termination while processing samples

Fixes #4044
This commit is contained in:
Alejandro Martinez
2021-11-03 10:38:23 -03:00
parent 7a08f9e92c
commit 320cddb1e1

View File

@@ -190,7 +190,8 @@ SportTracks::readdir(QString path, QStringList &errors, QDateTime, QDateTime)
// if successful, lets unpack
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
printd("fetch response: %d: %s\n", reply->error(), reply->errorString().toStdString().c_str());
printd("HTTP response code: %d\n", statusCode);
if (reply->error() != 0) printd("fetch response: %d: %s\n", reply->error(), reply->errorString().toStdString().c_str());
if (reply->error() == 0) {
@@ -449,7 +450,7 @@ SportTracks::readFileCompleted()
// We stop when all tracks have been accomodated
bool stop=true;
foreach(st_track track, data) if (track.index < track.samples.count()) stop=false;
foreach(st_track track, data) if (track.index < track.samples.count() && track.samples.at(track.samples.count()-2).toInt() >= index) stop=false;
if (stop) break;
// add new point for the point in time we are at