summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/tools/PolynomialRegressionCurveCalculator.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 530d0d4a16a5..b087fc52cede 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -186,7 +186,10 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression(
double aRSquared = 0.0;
if(mForceIntercept)
{
- aRSquared = aSumYpred2 / (aSumError + aSumYpred2);
+ if (auto const div = aSumError + aSumYpred2)
+ {
+ aRSquared = aSumYpred2 / div;
+ }
}
else if (aSumTotal != 0.0)
{