diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-01 20:38:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-01 21:02:16 +0000 |
commit | 78e670b3055f92740402803174d61d058effb5d7 (patch) | |
tree | 8a3b546fe1862adce59a582ca41562b16585b305 /sw | |
parent | 2149e924cbc32c370128c5f87a4f55c50c99e6bd (diff) |
coverity#1078538 Division or modulo by zero
Change-Id: I0ae8d51a569c2a63f5fb390e66fdbde4a8e8b5d5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/htmltbl.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index b7884056eaef..63a877f1020a 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -1455,9 +1455,14 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv } sal_uLong nAbsTabWidthL = nAbsTabWidth; - nRelTabWidth = - ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail) - : nAbsTabWidth ); + if (nRelAvail) + { + if (nAbsAvail == 0) + throw o3tl::divide_by_zero(); + nRelTabWidth = (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail); + } + else + nRelTabWidth = nAbsTabWidth; double nW = nAbsTabWidth - nMin; double nD = (nMax==nMin ? 1 : nMax-nMin); sal_uInt16 nAbs = 0, nRel = 0; |