diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-09-09 13:33:09 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-10-16 12:25:52 +0200 |
commit | 3f0abe19393cc6ffb1e1a786fc2bb1272abfe8be (patch) | |
tree | abd4a346c1d8ba880c38012769ba7ac2c201baff /sw | |
parent | 01a6c874a62b2398c17bc6a1c412f1fe7704bef9 (diff) |
sw: avoid divide by zero in SwDoc::AdjustCellWidth
See https://crashreport.libreoffice.org/stats/signature/SwDoc::AdjustCellWidth(SwCursor%20const%20&,bool,bool)
Change-Id: I98b90dcbed6b6f3ea0a7d1668a5c248f39e7a2a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139658
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit b884772e4aa3d6f438c8a74f3a15250530830162)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139661
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 4d0e38b794ab..923999f647cb 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1626,7 +1626,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, } fTotalWish += aWish[i]; } - const sal_uInt16 nEqualWidth = nSelectedWidth / nCols; + assert(nCols); + const sal_uInt16 nEqualWidth = nCols ? nSelectedWidth / nCols : 0; // bBalance: Distribute the width evenly for (sal_uInt16 & rn : aWish) if ( rn && bBalance ) |