summaryrefslogtreecommitdiffstats
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-19 21:19:47 +0200
commit49cdadd5878da393dc640a8f7ec75b98cb2e0147 (patch)
treeda1dc04a11172b3eb0010cdbc27479e210c3244c
parenttdf#137341 gtk: Set missing style text colors from theme (diff)
downloadcore-49cdadd5878da393dc640a8f7ec75b98cb2e0147.tar.gz
core-49cdadd5878da393dc640a8f7ec75b98cb2e0147.zip
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>
-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 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 )