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