From c50033a000d85f967bd5300dea0f9fec3411e501 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Tue, 13 Aug 2019 14:27:05 +0200 Subject: Writer: Saving a damaged file as DOCX crashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://gerrit.libreoffice.org/77412 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit de8415ff5a730465258cd5f0ab7c0d989ba5518d) Reviewed-on: https://gerrit.libreoffice.org/77444 Reviewed-by: Xisco Faulí (cherry picked from commit 0f7eb072fdc2d5b4ee1690597dafc475a611f007) Change-Id: I42de376c69d0b1caa0a03622506d1bf6385ca57e Reviewed-on: https://gerrit.libreoffice.org/77670 Tested-by: Jenkins Reviewed-by: Xisco Faulí --- sw/source/filter/ww8/docxsdrexport.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 50a1500c31b9..45c1d35f579b 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1371,14 +1371,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 explicitly - 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