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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 10:52:21 UTC 2019


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   28 +++++++---------------
 1 file changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 0f18a52b0d4aab218f6a87c33508915b3b7d08b7
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Oct 2 18:06:25 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Oct 10 12:51:43 2019 +0200

    writerfilter: remove pointless if in appendTextPortion()
    
    Change-Id: Iff8171b48a2687bbadb4e2638675a73de96a7545
    Reviewed-on: https://gerrit.libreoffice.org/80074
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cb6eb815c49e..6f6f74457486 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1768,25 +1768,17 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
                     {
                         m_bStartedTOC = true;
                         uno::Reference< text::XTextCursor > xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
+                        assert(xTOCTextCursor.is());
                         xTOCTextCursor->gotoEnd(false);
-                        if (xTOCTextCursor.is())
-                        {
-                            if (m_bStartIndex || m_bStartBibliography || m_bStartGenericField)
-                                xTOCTextCursor->goLeft(1, false);
-                            xTextRange = xTextAppend->insertTextPortion(rString, aValues, xTOCTextCursor);
-                            SAL_WARN_IF(!xTextRange.is(), "writerfilter.dmapper", "insertTextPortion failed");
-                            if (!xTextRange.is())
-                                throw uno::Exception("insertTextPortion failed", nullptr);
-                            m_bTextInserted = true;
-                            xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
-                            mxTOCTextCursor = xTOCTextCursor;
-                        }
-                        else
-                        {
-                            xTextRange = xTextAppend->appendTextPortion(rString, aValues);
-                            xTOCTextCursor = xTextAppend->createTextCursor();
-                            xTOCTextCursor->gotoRange(xTextRange->getEnd(), false);
-                        }
+                        if (m_bStartIndex || m_bStartBibliography || m_bStartGenericField)
+                            xTOCTextCursor->goLeft(1, false);
+                        xTextRange = xTextAppend->insertTextPortion(rString, aValues, xTOCTextCursor);
+                        SAL_WARN_IF(!xTextRange.is(), "writerfilter.dmapper", "insertTextPortion failed");
+                        if (!xTextRange.is())
+                            throw uno::Exception("insertTextPortion failed", nullptr);
+                        m_bTextInserted = true;
+                        xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
+                        mxTOCTextCursor = xTOCTextCursor;
                         m_aTextAppendStack.push(TextAppendContext(xTextAppend, xTOCTextCursor));
                     }
                 }


More information about the Libreoffice-commits mailing list