diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-26 10:39:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-26 12:23:19 +0100 |
commit | bc28dde1891fd6e3b7ded3f2603aaf63a9111106 (patch) | |
tree | 659d517bfdeb1fcabd46dc09ae2cf609584aa75d /sw | |
parent | a74c796865f434f6e7a8806667381d325491092b (diff) |
coverity#1409893 Division or modulo by float zero
Change-Id: I697e9c7772792b02257ed1f40666dd70bb70300c
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index ec94e4b88a4e..16b2dcaf7689 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -404,8 +404,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; |