summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-09-20 12:04:33 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-09-20 14:42:01 +0200
commit8a4c16916b49cc096779bb9fab86a5a90f514ae3 (patch)
tree4ee2940cd4ae42ccdc50d79e9e07ead5d33a6a96
parent9187b1a1cfe5ad0323a8523b1821831864de878d (diff)
avoid division by zero
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 <l.lunak@collabora.com>
-rw-r--r--sw/source/core/bastyp/swregion.cxx3
1 files changed, 2 insertions, 1 deletions
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<tools::Long>( 1, (*this)[i].Width());
size_type j = i+1;
while( j < size() && (*this)[j].Top() <= yMax )
++j;