From 0dd22165346f4296718656d17ae98ebbfe563719 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 29 Jul 2016 08:48:22 +0100 Subject: fftester: null DestinationText Change-Id: Icdd71733c4e9f4b36e6e957e4dea772087890faa --- .../cppunittests/rtftok/data/pass/destinationtest-1.rtf | Bin 0 -> 196 bytes writerfilter/source/rtftok/rtfdocumentimpl.cxx | 6 +++--- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf 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 000000000000..63465b073627 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 45be8a691d4e..e3cd2b9f8bef 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 c8a28d321717..152f5a66af8a 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. -- cgit v1.2.3