summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-17 09:38:45 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2023-04-18 11:48:57 +0200
commitfde5e93fb09d079cbd145a08469e56339f58c4f9 (patch)
treeb2697c55599b1eaf2f170e29dab9eab0894483c1
parent756e7701486318e72dce823f3946b7b2ea350132 (diff)
Resolves: tdf#146068 don't crash when MA(central) lacks data
Change-Id: I2c9b78f4d1a963bb71abb21068e61e6983ade777 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150500 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 6236f73b398d..6726d9d78b36 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -84,6 +84,8 @@ void MovingAverageRegressionCurveCalculator::calculateValuesCentral(
RegressionCalculationHelper::tDoubleVectorPair aValues)
{
const size_t aSize = aValues.first.size();
+ if (aSize == 0)
+ return;
for (size_t i = mPeriod - 1; i < aSize; ++i)
{
double yAvg = 0.0;