sw/qa/core/data/ooxml/pass/tdf123001.docx |binary writerfilter/source/dmapper/DomainMapper_Impl.cxx | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
New commits: commit 5213c70a2d6cfd08750145e5b8152180ef7b5faa Author: László Németh <nem...@numbertext.org> AuthorDate: Thu Apr 9 17:20:18 2020 +0200 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Tue Apr 14 20:12:39 2020 +0200 tdf#132001 DOCX import: fix crash: redline in floating table Copying redlines to frame text was failed in tables inside frames. Skip these redlines temporarily. Regression from commit e8bae67b3dbcc90ace8264b6b1aefaf0ce459aba (tdf#125894: DOCX: import tracked changes in frames). Change-Id: I4f3ca2e95fb2e7637f8cf8dca1088a7727bcf98d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91985 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 1350832be533ce6627607b1aaabd2b3565e6e7b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92015 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sw/qa/core/data/ooxml/pass/tdf123001.docx b/sw/qa/core/data/ooxml/pass/tdf123001.docx new file mode 100644 index 000000000000..e94a66208e0d Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/tdf123001.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8e13daa08efb..13f1ce4ad6a2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6264,10 +6264,19 @@ void DomainMapper_Impl::ExecuteFrameConversion() uno::Reference< text::XTextRange > xRange; aFramedRedlines[i] >>= xRange; uno::Reference<text::XTextCursor> xRangeCursor = GetTopTextAppend()->createTextCursorByRange( xRange ); - sal_Int32 nLen = xRange->getString().getLength(); - redLen.push_back(nLen); - xRangeCursor->gotoRange(m_xFrameStartRange, true); - redPos.push_back(xRangeCursor->getString().getLength() - nLen); + if (xRangeCursor.is()) + { + sal_Int32 nLen = xRange->getString().getLength(); + redLen.push_back(nLen); + xRangeCursor->gotoRange(m_xFrameStartRange, true); + redPos.push_back(xRangeCursor->getString().getLength() - nLen); + } + else + { + // failed createTextCursorByRange(), for example, table inside the frame + redLen.push_back(-1); + redPos.push_back(-1); + } } const uno::Reference< text::XTextContent >& xTextContent = xTextAppendAndConvert->convertToTextFrame( @@ -6280,6 +6289,9 @@ void DomainMapper_Impl::ExecuteFrameConversion() { OUString sType; beans::PropertyValues aRedlineProperties( 3 ); + // skip failed createTextCursorByRange() + if (redPos[i/3] == -1) + continue; aFramedRedlines[i+1] >>= sType; aFramedRedlines[i+2] >>= aRedlineProperties; uno::Reference< text::XTextFrame > xFrame( xTextContent, uno::UNO_QUERY_THROW ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits