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

New commits:
commit 4a7b856c2b6b97b9538a6945cf2afa95e59a3031
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 9 13:33:09 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Sep 9 19:17:52 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/+/139658
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 59c9154f74ca..678861ca08e1 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1670,7 +1670,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