writerfilter/source/dmapper/DomainMapperTableManager.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3a457df72a832ee19d6c9b6da01aa88e83e203af
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 9 12:22:55 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Sep 19 21:20:33 2022 +0200

    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 <caol...@redhat.com>
    (cherry picked from commit b69a37e567a6a0b6c24a4438a0da906497c750f0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139660

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];

Reply via email to