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

New commits:
commit 49cdadd5878da393dc640a8f7ec75b98cb2e0147
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 9 13:33:09 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Sep 19 21:19:47 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
    (cherry picked from commit b884772e4aa3d6f438c8a74f3a15250530830162)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139661
    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 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 )

Reply via email to