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>
This commit is contained in:
Samuel Mehrbrodt 2021-04-15 08:42:09 +02:00
parent cf5cc42785
commit a6066989f7

View file

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