sw/qa/extras/rtfimport/data/tdf167254.rtf       |   22 ++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx            |    6 ++++++
 sw/source/writerfilter/dmapper/TableManager.cxx |    2 +-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 1ebd8cb8fa272d7bd5c5b051a625d79e5957363d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jun 27 02:04:53 2025 +0500
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 11 07:33:42 2025 +0200

    tdf#167254: check if getCellCount gives zero
    
    Regression since commit 038473595ed266d15a788d8f97781cbaf066cfe7
    (tdf#152839 add fill cells to tables imported wrongly from RTF, 2024-10-11).
    
    Change-Id: Ie2da84eb358d291bcc584a86ae69843f13186c3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187073
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187089
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187108
    (cherry picked from commit 609197187c4f3bc2b78db0bd713dae615b28d39e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187312
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/qa/extras/rtfimport/data/tdf167254.rtf 
b/sw/qa/extras/rtfimport/data/tdf167254.rtf
new file mode 100644
index 000000000000..5ad617f72fb1
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf167254.rtf
@@ -0,0 +1,22 @@
+{ tf1
+       rowd
+++\intbl A1+\intbl B1+\intbl ow\pard
+       rowd
+++\intbl A2+\intbl B2+\intbl ow\pard
+       rowd
+++\intbl A3+\intbl B3+\intbl ow\pard
+       rowd
+\intbl ow\pard
+}
\ No newline at end of file
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index defc0bf4a5cc..1e4da747f081 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2003,6 +2003,12 @@ CPPUNIT_TEST_FIXTURE(Test, test165805Tdf)
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf167254)
+{
+    createSwDoc("tdf167254.rtf");
+    // It must not crash on import
+}
+
 CPPUNIT_TEST_FIXTURE(Test, test165483Tdf)
 {
     createSwDoc("165483.rtf");
diff --git a/sw/source/writerfilter/dmapper/TableManager.cxx 
b/sw/source/writerfilter/dmapper/TableManager.cxx
index 6f16d9e0c01e..fed6922f2991 100644
--- a/sw/source/writerfilter/dmapper/TableManager.cxx
+++ b/sw/source/writerfilter/dmapper/TableManager.cxx
@@ -406,7 +406,7 @@ void TableManager::HandleSmallerRows()
             RowData::Pointer_t pRowData = pTableData->getRow(nRow);
             sal_Int32 nRowWidth = 0;
             pRowData->getProperties()->getValue(TablePropertyMap::TABLE_WIDTH, 
nRowWidth);
-            if (nRowWidth < nMaxRowWidth)
+            if (nRowWidth < nMaxRowWidth && pRowData->getCellCount() > 0)
             {
                 uno::Reference<text::XTextRange> xTextRange
                     = pRowData->getCellEnd(pRowData->getCellCount() - 1);

Reply via email to