summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-09-09 12:22:55 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-09-19 21:20:33 +0200
commit3a457df72a832ee19d6c9b6da01aa88e83e203af (patch)
treede58aa944eeeda2b68bbb08edfb952469ab567a3
parent49cdadd5878da393dc640a8f7ec75b98cb2e0147 (diff)
writerfilter: avoid divide by zero
in DomainMapperTableManager::endOfRowAction() See https://crashreport.libreoffice.org/stats/signature/writerfilter::dmapper::DomainMapperTableManager::endOfRowAction() Probably since 116cadb5d2582532c69677a2f8499e8e9b7b9b80 "tdf#59274 DOCX import: fix tables with incomplete grid" Change-Id: I12f2842107885fbbc62be2186511102f642e3efc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139657 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b69a37e567a6a0b6c24a4438a0da906497c750f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139660
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 127f9b067c4d..c3e44542d5f7 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -797,9 +797,6 @@ void DomainMapperTableManager::endOfRowAction()
size_t nWidthsBound = pCellWidths->size() - 1;
if (nWidthsBound)
{
- if (nFullWidthRelative == 0)
- throw o3tl::divide_by_zero();
-
// At incomplete table grids, last cell width can be smaller, than its final width.
// Correct it based on the last but one column width and their span values.
if ( bIsIncompleteGrid && rCurrentSpans.size()-1 == nWidthsBound )
@@ -810,6 +807,9 @@ void DomainMapperTableManager::endOfRowAction()
nFullWidthRelative += nFixLastCellWidth - (*pCellWidths)[nWidthsBound];
}
+ if (nFullWidthRelative == 0)
+ throw o3tl::divide_by_zero();
+
for (size_t i = 0; i < nWidthsBound; ++i)
{
nSum += (*pCellWidths)[i];