summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-09-09 13:33:09 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-09-09 15:48:50 +0200
commitd26faae8359ccf2e3475ef9e319c97485b76d08d (patch)
tree6382f5fb7953aac86f6061a1086f14897fdbb44a
parent521d438c41b2ac59bffc94763d1a2cb568ff9a60 (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/+/139723 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx3
1 files changed, 2 insertions, 1 deletions
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 )