From 0bebe41b5387ee28519cb2f1f62b68a23b2abd9b Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Tue, 13 Aug 2019 10:29:40 +0200 Subject: bccu#4204: Writer: Saving this damaged file as DOCX crashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I526864d6a425220d342bcf0b5a195f420cbf1563 Reviewed-on: https://gerrit.libreoffice.org/77381 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai --- sw/source/filter/ww8/docxsdrexport.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 459811f0a56b..782e8e4b0760 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1596,14 +1596,17 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho // We need to init padding to 0, if it's not set. // In LO the default is 0 and so ins attributes are not set when padding is 0 // but in MSO the default is 254 / 127, so we need to set 0 padding explicitely - if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_lIns)) - m_pImpl->m_pBodyPrAttrList->add(XML_lIns, OString::number(0)); - if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_tIns)) - m_pImpl->m_pBodyPrAttrList->add(XML_tIns, OString::number(0)); - if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_rIns)) - m_pImpl->m_pBodyPrAttrList->add(XML_rIns, OString::number(0)); - if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_bIns)) - m_pImpl->m_pBodyPrAttrList->add(XML_bIns, OString::number(0)); + if(m_pImpl->m_pBodyPrAttrList) + { + if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_lIns)) + m_pImpl->m_pBodyPrAttrList->add(XML_lIns, OString::number(0)); + if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_tIns)) + m_pImpl->m_pBodyPrAttrList->add(XML_tIns, OString::number(0)); + if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_rIns)) + m_pImpl->m_pBodyPrAttrList->add(XML_rIns, OString::number(0)); + if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_bIns)) + m_pImpl->m_pBodyPrAttrList->add(XML_bIns, OString::number(0)); + } sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->m_pBodyPrAttrList); m_pImpl->m_pBodyPrAttrList = nullptr; -- cgit v1.2.3