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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Tue May 5 18:36:20 UTC 2020


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 2cdec016bc763f5fc9dede8835c8f45139e811ca
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Mon May 4 09:32:16 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Tue May 5 20:35:42 2020 +0200

    writerfilter: cleanup out-of-order xText <-> xCrsr
    
    This looks mostly like copy/paste proliferation of
    a pointless test for xText after it has already
    been used.
    
    Since this has already been working for years,
    there is no point in testing if xText.is(),
    since it would have crashed if it wasn't
    during the xCrsr definition.
    
    Change-Id: I6a032c0bdc7bb587f223f191623a2e3885d444bb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93412
    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 f385565c8429..0465981ca6ba 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -467,8 +467,7 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
     {
         uno::Reference< text::XTextAppend >  xTextAppend = m_aTextAppendStack.top().xTextAppend;
         uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
-        uno::Reference< text::XText > xText = xTextAppend->getText();
-        if(xCrsr.is() && xText.is())
+        if (xCrsr.is())
         {
             xTextAppend->finishParagraph(  uno::Sequence< beans::PropertyValue >() );
             SetIsDummyParaAddedForTableInSection(true);
@@ -4828,8 +4827,7 @@ void DomainMapper_Impl::CloseFieldCommand()
                 if (xTextAppend.is())
                 {
                     uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
-                    uno::Reference< text::XText > xText = xTextAppend->getText();
-                    if(xCrsr.is() && xText.is())
+                    if (xCrsr.is())
                     {
                         xCrsr->gotoEnd(false);
                         uno::Reference< beans::XPropertySet > xProp( xCrsr, uno::UNO_QUERY );
@@ -5410,9 +5408,9 @@ void DomainMapper_Impl::CloseFieldCommand()
 
                         if (xTextAppend.is())
                         {
-                            uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
                             uno::Reference< text::XText > xText = xTextAppend->getText();
-                            if(xCrsr.is() && xText.is())
+                            uno::Reference< text::XTextCursor > xCrsr = xText->createTextCursor();
+                            if (xCrsr.is())
                             {
                                 xCrsr->gotoEnd(false);
                                 xText->insertString(xCrsr, sSymbol, true);
@@ -5485,10 +5483,9 @@ void DomainMapper_Impl::CloseFieldCommand()
                         uno::Reference< text::XTextAppend >  xTextAppend = m_aTextAppendStack.top().xTextAppend;
                         if (xTextAppend.is())
                         {
-                            uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
-
                             uno::Reference< text::XText > xText = xTextAppend->getText();
-                            if(xCrsr.is() && xText.is())
+                            uno::Reference< text::XTextCursor > xCrsr = xText->createTextCursor();
+                            if (xCrsr.is())
                             {
                                 xCrsr->gotoEnd(false);
                                 xText->insertTextContent(uno::Reference< text::XTextRange >( xCrsr, uno::UNO_QUERY_THROW ), xToInsert, false);


More information about the Libreoffice-commits mailing list