dev/null |binary writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-1.rtf |binary writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-2.rtf |binary writerfilter/source/rtftok/rtfdocumentimpl.cxx | 39 +++++----- 4 files changed, 20 insertions(+), 19 deletions(-)
New commits: commit f9ae1b31f7791fba71f74af126cc061a048e12f8 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 29 09:18:16 2016 +0100 fftester: another null DestinationText Change-Id: I84bf3788ac092c491d7c5a9f86421f1cf9f3e814 diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-1.rtf similarity index 100% rename from writerfilter/qa/cppunittests/rtftok/data/pass/destinationtest-1.rtf rename to writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-1.rtf diff --git a/writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-2.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-2.rtf new file mode 100644 index 0000000..f0152b0 Binary files /dev/null and b/writerfilter/qa/cppunittests/rtftok/data/fail/destinationtest-2.rtf differ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e3cd2b9..909dc86 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -190,26 +190,27 @@ static util::DateTime lcl_getDateTime(RTFParserState& aState) aState.nDay, aState.nMonth, aState.nYear, false); } -static void lcl_DestinationToMath(OUStringBuffer& rDestinationText, oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor) +static void lcl_DestinationToMath(OUStringBuffer* pDestinationText, oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor) { - OUString aStr = rDestinationText.makeStringAndClear(); - if (!aStr.isEmpty()) + if (!pDestinationText) + return; + OUString aStr = pDestinationText->makeStringAndClear(); + if (aStr.isEmpty()) + return; + rMathBuffer.appendOpeningTag(M_TOKEN(r)); + if (rMathNor) { - rMathBuffer.appendOpeningTag(M_TOKEN(r)); - if (rMathNor) - { - rMathBuffer.appendOpeningTag(M_TOKEN(rPr)); - // Same as M_TOKEN(lit) - rMathBuffer.appendOpeningTag(M_TOKEN(nor)); - rMathBuffer.appendClosingTag(M_TOKEN(nor)); - rMathBuffer.appendClosingTag(M_TOKEN(rPr)); - rMathNor = false; - } - rMathBuffer.appendOpeningTag(M_TOKEN(t)); - rMathBuffer.appendCharacters(aStr); - rMathBuffer.appendClosingTag(M_TOKEN(t)); - rMathBuffer.appendClosingTag(M_TOKEN(r)); + rMathBuffer.appendOpeningTag(M_TOKEN(rPr)); + // Same as M_TOKEN(lit) + rMathBuffer.appendOpeningTag(M_TOKEN(nor)); + rMathBuffer.appendClosingTag(M_TOKEN(nor)); + rMathBuffer.appendClosingTag(M_TOKEN(rPr)); + rMathNor = false; } + rMathBuffer.appendOpeningTag(M_TOKEN(t)); + rMathBuffer.appendCharacters(aStr); + rMathBuffer.appendClosingTag(M_TOKEN(t)); + rMathBuffer.appendClosingTag(M_TOKEN(r)); } RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext, @@ -1768,7 +1769,7 @@ RTFError RTFDocumentImpl::pushState() m_aStates.top().eRunType = RTFParserState::RunType::LOCH; if (m_aStates.top().eDestination == Destination::MR) - lcl_DestinationToMath(*m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); + lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); m_aStates.push(m_aStates.top()); } m_aStates.top().aDestinationText.setLength(0); // was copied: always reset! @@ -2463,7 +2464,7 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::MR: - lcl_DestinationToMath(*m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); + lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); break; case Destination::MF: m_aMathBuffer.appendClosingTag(M_TOKEN(f));
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits