diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-26 10:39:47 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-06-06 14:03:19 +0200 |
commit | 2a04bf86d9e8f5e04115780d2cae6322b52ef522 (patch) | |
tree | 770a05810d159db8519933bddc6e59a856533c57 | |
parent | 781c8986f2efa35229ab662edef5ebe06c3ca4f3 (diff) |
coverity#1409893 Division or modulo by float zero
Change-Id: I697e9c7772792b02257ed1f40666dd70bb70300c
(cherry picked from commit bc28dde1891fd6e3b7ded3f2603aaf63a9111106)
-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 bd139d75799c..1627ce0bd8d9 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; |