summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-04-15 08:42:09 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-04-15 10:27:11 +0200
commita6066989f7d346d0d43f8db46b12786546f769e8 (patch)
treeafa07f70b587de4cac4dbc17d954b4fa01b9a88f
parentcf5cc42785eae15dc19f06f391d614832b16be20 (diff)
tdf#141689 Fix crash in 'Central' moving avg function
Change-Id: I2dc5e517d5e3ff6283c9ff66c9f32ee95d66ef45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114121 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r--chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 5496f78577e6..1c456b8835e6 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -145,9 +145,10 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL MovingAverageRegressionCurveCalc
const uno::Reference< chart2::XScaling >& /*xScalingY*/,
sal_Bool /*bMaySkipPointsInCalculation*/ )
{
- uno::Sequence< geometry::RealPoint2D > aResult( aYList.size() );
+ size_t nSize = std::min(aXList.size(), aYList.size());
+ uno::Sequence< geometry::RealPoint2D > aResult( nSize );
- for( size_t i = 0; i < aYList.size(); ++i )
+ for( size_t i = 0; i < nSize; ++i )
{
aResult[i].X = aXList[i];
aResult[i].Y = aYList[i];