summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-04-28 15:38:56 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-12 14:16:13 +0200
commit0d1c4596c4d2a293c6093c0351d1da714282a91d (patch)
tree1ee14522ffd91783dcf5ddc2742474edf7e1eef5
parentlibxml2: upgrade to release 2.9.14 (diff)
downloadcore-0d1c4596c4d2a293c6093c0351d1da714282a91d.tar.gz
core-0d1c4596c4d2a293c6093c0351d1da714282a91d.zip
sw: avoid EXCEPTION_INT_DIVIDE_BY_ZERO
Seen in https://crashreport.libreoffice.org/stats/signature/SwBookmarkPortion::DoPaint(SwTextPaintInfo%20const%20&,rtl::OUString%20&,SwFont%20&,int%20&) Introduced by 4ce8120f1e53f7b81e653b01d141643013bc69ab "tdf#45589 sw: create and paint text portions for bookmarks" Change-Id: I7d025878164e1f97b86f9d129af9ba93e93b6ba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133562 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 7c8b9fa98f4c5f7f5620e797dbbe24081e252548) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133602 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit e2ee797ebba6ee52387cbbd662ee35d84943f0ce) (cherry picked from commit 5055aad4697f19e0f45ed4f6e2a3efbdf055d6ae)
-rw-r--r--sw/source/core/text/porrst.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 654ddec99fea..213cb3b5e7e0 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -540,7 +540,7 @@ bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rInf,
Size size(rTmpFont.GetSize(rTmpFont.GetActual()));
// use also the external leading (line gap) of the portion, but don't use
// 100% of it because i can't figure out how to baseline align that
- auto const nFactor = (Height() * 95) / size.Height();
+ auto const nFactor = size.Height() > 0 ? (Height() * 95) / size.Height() : Height();
rTmpFont.SetProportion(nFactor);
rTmpFont.SetWeight(WEIGHT_THIN, rTmpFont.GetActual());
rTmpFont.SetColor(NON_PRINTING_CHARACTER_COLOR);