[Libreoffice-commits] core.git: sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 10 13:39:25 UTC 2020


 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 1350832be533ce6627607b1aaabd2b3565e6e7b3
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Apr 9 17:20:18 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Apr 10 15:38:52 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 <nemeth at numbertext.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 a5ba85300ea6..4a7c8f7e4995 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6439,10 +6439,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(
@@ -6455,6 +6464,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 );


More information about the Libreoffice-commits mailing list