From 8a4c16916b49cc096779bb9fab86a5a90f514ae3 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 20 Sep 2021 12:04:33 +0200 Subject: avoid division by zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A rectangle in SwRegionRects may apparently be empty. Change-Id: I0956be2921d5110e2a8b9867bebf99814dd222f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122351 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- sw/source/core/bastyp/swregion.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx index 21e645500fa0..52dbd6a3a59a 100644 --- a/sw/source/core/bastyp/swregion.cxx +++ b/sw/source/core/bastyp/swregion.cxx @@ -165,7 +165,8 @@ void SwRegionRects::Compress() // that are possibly overlapping or adjacent or close enough to be grouped by the fuzzy // code below. const tools::Long nFuzzy = 1361513; - const tools::Long yMax = (*this)[i].Bottom() + nFuzzy / (*this)[i].Width(); + const tools::Long yMax = (*this)[i].Bottom() + nFuzzy + / std::max( 1, (*this)[i].Width()); size_type j = i+1; while( j < size() && (*this)[j].Top() <= yMax ) ++j; -- cgit