summaryrefslogtreecommitdiff
path: root/sw/source
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-21 10:28:49 +0200
commitb146e54a206a52da00de1fb98b49922bdea8cbce (patch)
tree973a209f66498fd9d5d50b875dfc2cb74e2741d8 /sw/source
parentaf06055bae54481d5d07dc33fa7c2204978106d7 (diff)
avoid division by zero
A rectangle in SwRegionRects may apparently be empty. Change-Id: I0956be2921d5110e2a8b9867bebf99814dd222f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122277 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sw/source')
-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 a54f9e4bddec..6a570bcdd091 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -166,7 +166,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;