Fix SEGV LTM Edit

.. when using Moving Average trend.
This commit is contained in:
Mark Liversedge
2015-08-13 17:38:07 +01:00
parent e2cb864d5b
commit 3b72bfcd4f

View File

@@ -755,6 +755,7 @@ LTMPlot::setData(LTMSettings *set)
// we need to fill in the gaps sadly
int lcount = xdata[count];
if (lcount) {
// calculated values
QVector<double> xtrend(lcount);
QVector<double> btrend(lcount);
@@ -767,7 +768,7 @@ LTMPlot::setData(LTMSettings *set)
ytrend[0] = ydata[0];
xtrend[0] = 0;
for (int n=1,i=1; i<= lcount; i++) {
for (int n=1,i=1; i<= lcount && i<xdata.size(); i++) {
// fill in gaps (and check bounds as we go too)
while (n<=xdata[i] && n<lcount) {
@@ -787,6 +788,7 @@ LTMPlot::setData(LTMSettings *set)
curves.insert(trendSymbol, trend);
}
}
}
// highlight outliers
if (metricDetail.topOut > 0 && metricDetail.topOut < count && count > 10) {
@@ -1860,6 +1862,7 @@ LTMPlot::setCompareData(LTMSettings *set)
// we need to fill in the gaps sadly
int lcount = xdata[count];
if (lcount) {
// calculated values
QVector<double> xtrend(lcount);
QVector<double> btrend(lcount);
@@ -1872,7 +1875,7 @@ LTMPlot::setCompareData(LTMSettings *set)
ytrend[0] = ydata[0];
xtrend[0] = 0;
for (int n=1,i=1; i<= lcount; i++) {
for (int n=1,i=1; i<= lcount && i<xdata.size(); i++) {
// fill in gaps (and check bounds as we go too)
while (n<=xdata[i] && n<lcount) {
@@ -1892,6 +1895,7 @@ LTMPlot::setCompareData(LTMSettings *set)
curves.insert(trendSymbol, trend);
}
}
}
// highlight outliers
if (metricDetail.topOut > 0 && metricDetail.topOut < count && count > 10) {