summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/htmltbl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-29 09:51:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-10-29 10:40:10 +0000
commit6fa813da677e303ca61074a2cda2c0e103fe5469 (patch)
treed2933e5fb69f2ae0a2325ac014ad635499155d5d /sw/source/core/doc/htmltbl.cxx
parentc4e53fadbd9d4d5444547a18269eea5c54fd7a89 (diff)
coverity#1078538 Division or modulo by zero
Change-Id: I4f8f66689b46f594664c44da4e892983f38ad32e
Diffstat (limited to 'sw/source/core/doc/htmltbl.cxx')
-rw-r--r--sw/source/core/doc/htmltbl.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index ba18c2710611..b7884056eaef 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1329,9 +1329,14 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// Only use the relative widths' fraction, that is used for the
// absolute width.
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;
// Are there columns width a percentage setting and some without one?
sal_uLong nFixMax = nMax;