sw/source/core/docnode/ndtbl1.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d26faae8359ccf2e3475ef9e319c97485b76d08d
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 9 13:33:09 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Sep 9 15:48:50 2022 +0200

    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/+/139723
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 53d925912d25..c50995b42904 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1662,7 +1662,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 )

Reply via email to