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

Caolán McNamara caolanm at redhat.com
Fri Jul 29 07:51:04 UTC 2016


 writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf |binary
 writerfilter/source/rtftok/rtfdocumentimpl.cxx                      |    6 +++---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx                      |    6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 0dd22165346f4296718656d17ae98ebbfe563719
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 29 08:48:22 2016 +0100

    fftester: null DestinationText
    
    Change-Id: Icdd71733c4e9f4b36e6e957e4dea772087890faa

diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf
new file mode 100644
index 0000000..63465b0
Binary files /dev/null and b/writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf differ
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45be8a6..e3cd2b9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1213,7 +1213,7 @@ void RTFDocumentImpl::text(OUString& rString)
             rString = rString.copy(0, rString.getLength() - 1);
             bEnd = true;
         }
-        m_aStates.top().pDestinationText->append(rString);
+        m_aStates.top().appendDestinationText(rString);
         if (bEnd)
         {
             // always clear, necessary in case of group-less fonttable
@@ -1319,7 +1319,7 @@ void RTFDocumentImpl::text(OUString& rString)
     case Destination::TOCENTRY:
     case Destination::PROPNAME:
     case Destination::STATICVAL:
-        m_aStates.top().pDestinationText->append(rString);
+        m_aStates.top().appendDestinationText(rString);
         break;
     default:
         bRet = false;
@@ -1348,7 +1348,7 @@ void RTFDocumentImpl::text(OUString& rString)
     // Don't return earlier, a bookmark start has to be in a paragraph group.
     if (m_aStates.top().eDestination == Destination::BOOKMARKSTART)
     {
-        m_aStates.top().pDestinationText->append(rString);
+        m_aStates.top().appendDestinationText(rString);
         return;
     }
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index c8a28d3..152f5a6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -282,6 +282,12 @@ public:
     /// point to the buffer of the current destination
     OUStringBuffer* pDestinationText;
 
+    void appendDestinationText(const OUString &rString)
+    {
+        if (pDestinationText)
+            pDestinationText->append(rString);
+    }
+
     /// Index of the current style.
     int nCurrentStyleIndex;
     /// Index of the current character style.


More information about the Libreoffice-commits mailing list