From 3c65bc2ea4d77890815864370cd74c0c74fbd536 Mon Sep 17 00:00:00 2001 From: Vianney Boyer Date: Sat, 14 Nov 2015 11:03:56 +0100 Subject: [PATCH] extend out of range fix in case of bad file --- src/VideoWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VideoWindow.cpp b/src/VideoWindow.cpp index b35131a32..38e41b34b 100644 --- a/src/VideoWindow.cpp +++ b/src/VideoWindow.cpp @@ -330,10 +330,10 @@ void VideoWindow::telemetryUpdate(RealtimeData rtd) QVector VideoSyncFiledataPoints = context->currentVideoSyncFile()->Points; - if (!VideoSyncFiledataPoints.count()) return; + if (VideoSyncFiledataPoints.count()<2) return; if(curPosition > VideoSyncFiledataPoints.count()-1 || curPosition < 1) - curPosition = 1; + curPosition = 1; // minimum curPosition is 1 as we will use [curPosition-1] double CurrentDistance = qBound(0.0, rtd.getDistance() + context->currentVideoSyncFile()->manualOffset, context->currentVideoSyncFile()->Distance); context->currentVideoSyncFile()->km = CurrentDistance; @@ -354,10 +354,10 @@ void VideoWindow::telemetryUpdate(RealtimeData rtd) //TODO : GPX file format // otherwise we use the gpx from selected ride in analysis view: QVector dataPoints = myRideItem->ride()->dataPoints(); - if (!dataPoints.count()) return; + if (dataPoints.count()<2) return; if(curPosition > dataPoints.count()-1 || curPosition < 1) - curPosition = 1; + curPosition = 1; // minimum curPosition is 1 as we will use [curPosition-1] // make sure the current position is less than the new distance while ((dataPoints[curPosition]->km > rtd.getDistance()) && (curPosition > 1))