sw/qa/extras/ooxmlexport/data/ooo30436-1-minimized.sxw |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 7 +++++++ sw/source/core/table/swtable.cxx | 11 +++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit 966e955ea09772ad1e3363f1813e5b26bfa41671 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed May 3 12:35:45 2023 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed May 3 14:11:03 2023 +0200 tdf#155134 DOCX export: fix crash with old table format Handle missing start nodes of boxes in old table format. Regression from commit dd5e5f3fab4b8f736baeda0f706c77a4ea9b6804 "tdf#150824 sw DOCX: fix export of new tracked tables". Change-Id: Ib10afa52351c683c3d3407aff567d6a8e2c76306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151318 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/ooo30436-1-minimized.sxw b/sw/qa/extras/ooxmlexport/data/ooo30436-1-minimized.sxw new file mode 100644 index 000000000000..140d6b23ea4a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ooo30436-1-minimized.sxw differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 661d2415e6cb..3805b8c8f593 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1323,6 +1323,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150824, "tdf150824.fodt") } } +DECLARE_OOXMLEXPORT_TEST(testTdf150824_regression, "ooo30436-1-minimized.sxw") +{ + // There should be no crash during loading of the document + // so, let's check just how much pages we have + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf113608_runAwayNumbering, "tdf113608_runAwayNumbering.docx") { // check that an incorrect numbering style is not applied diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 5fda482c35e0..d4881974e5df 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1895,8 +1895,15 @@ SwRedlineTable::size_type SwTableLine::UpdateTextChangesOnly( SwRedlineTable::size_type SwTableLine::GetTableRedline() const { const SwRedlineTable& aRedlineTable = GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); - const SwPosition aLineStart(*GetTabBoxes().front()->GetSttNd()); - const SwPosition aLineEnd(*GetTabBoxes().back()->GetSttNd()); + const SwStartNode* pFirstBox = GetTabBoxes().front()->GetSttNd(); + const SwStartNode* pLastBox = GetTabBoxes().back()->GetSttNd(); + + // Box with no start node + if ( !pFirstBox || !pLastBox ) + return SwRedlineTable::npos; + + const SwPosition aLineStart(*pFirstBox); + const SwPosition aLineEnd(*pLastBox); SwRedlineTable::size_type n = 0; const SwRangeRedline* pFnd = aRedlineTable.FindAtPosition( aLineStart, n, /*next=*/false );