From 9109eb616f910e64ad74d13cd1e1320a034f60aa Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 4 Aug 2010 22:19:46 +0100 Subject: [PATCH] Fix crash in AllPlot on Manual Ride When a manual ride is selected whilst on allplot it will refresh the plots, but computes invalid offsets into the ride data. this patch fixes this crash. Fixes #128. --- src/AllPlot.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index 30b0e1f06..d60db0d91 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -608,6 +608,9 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx) stopidx = plot->timeIndex(plot->timeArray[(stopidx>=plot->timeArray.size()?plot->timeArray.size()-1:stopidx)]/60)-1; } + // make sure indexes are still valid + if (startidx > stopidx || startidx < 0 || stopidx < 0) return; + double *smoothW = &plot->smoothWatts[startidx]; double *smoothT = &plot->smoothTime[startidx]; double *smoothHR = &plot->smoothHr[startidx];