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.
This commit is contained in:
Mark Liversedge
2010-08-04 22:19:46 +01:00
parent de0b28f9dc
commit 9109eb616f

View File

@@ -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];