diff options
author | László Németh <nemeth@numbertext.org> | 2020-04-09 17:20:18 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-04-14 20:12:39 +0200 |
commit | 5213c70a2d6cfd08750145e5b8152180ef7b5faa (patch) | |
tree | a3b6dac8725271fc6c6a617789e7fa745a9c2ef1 | |
parent | f973091959dacd74501606a01099f107d25d8fc7 (diff) |
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 <nemeth@numbertext.org>
(cherry picked from commit 1350832be533ce6627607b1aaabd2b3565e6e7b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92015
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/qa/core/data/ooxml/pass/tdf123001.docx | bin | 0 -> 31943 bytes | |||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 20 |
2 files changed, 16 insertions, 4 deletions
diff --git a/sw/qa/core/data/ooxml/pass/tdf123001.docx b/sw/qa/core/data/ooxml/pass/tdf123001.docx Binary files differnew file mode 100644 index 000000000000..e94a66208e0d --- /dev/null +++ b/sw/qa/core/data/ooxml/pass/tdf123001.docx 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 ); |