summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-26 10:39:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-18 15:07:01 +0200
commit5dadc59dd1f9b4ff27221e231a5f37d31e9a41f5 (patch)
tree881021c6392683fa9a96dc519798c654ec2c2c09
parente4335f77cffeaa35883b82a00eed1ff8f4665288 (diff)
coverity#1409893 Division or modulo by float zero
Change-Id: I697e9c7772792b02257ed1f40666dd70bb70300c Reviewed-on: https://gerrit.libreoffice.org/38914 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index c2cf6252dec0..b44cdf43a115 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -425,8 +425,12 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
OutputDevice* pOut = Application::GetDefaultDevice();
vcl::Font aFont(pOut->GetFont());
aFont.SetFamilyName(sFont);
- fRatio = aFont.GetFontSize().Height();
- fRatio /= pOut->GetTextWidth(rWatermark.GetText());
+ auto nTextWidth = pOut->GetTextWidth(rWatermark.GetText());
+ if (nTextWidth)
+ {
+ fRatio = aFont.GetFontSize().Height();
+ fRatio /= nTextWidth;
+ }
// Calc the size.
sal_Int32 nWidth = 0;