[Libreoffice-commits] core.git: sw/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 17:48:35 UTC 2019


 sw/source/filter/ww8/docxsdrexport.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit de8415ff5a730465258cd5f0ab7c0d989ba5518d
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Aug 13 14:27:05 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Aug 13 19:47:53 2019 +0200

    Writer: Saving a damaged file as DOCX crashes
    
    Change-Id: I42de376c69d0b1caa0a03622506d1bf6385ca57e
    Reviewed-on: https://gerrit.libreoffice.org/77412
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 9a57f65a5fd7..b65ca4a383f7 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1383,14 +1383,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->getBodyPrAttrList()->hasAttribute(XML_lIns))
-        m_pImpl->getBodyPrAttrList()->add(XML_lIns, OString::number(0));
-    if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_tIns))
-        m_pImpl->getBodyPrAttrList()->add(XML_tIns, OString::number(0));
-    if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_rIns))
-        m_pImpl->getBodyPrAttrList()->add(XML_rIns, OString::number(0));
-    if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_bIns))
-        m_pImpl->getBodyPrAttrList()->add(XML_bIns, OString::number(0));
+    if (m_pImpl->getBodyPrAttrList())
+    {
+        if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_lIns))
+            m_pImpl->getBodyPrAttrList()->add(XML_lIns, OString::number(0));
+        if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_tIns))
+            m_pImpl->getBodyPrAttrList()->add(XML_tIns, OString::number(0));
+        if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_rIns))
+            m_pImpl->getBodyPrAttrList()->add(XML_rIns, OString::number(0));
+        if (!m_pImpl->getBodyPrAttrList()->hasAttribute(XML_bIns))
+            m_pImpl->getBodyPrAttrList()->add(XML_bIns, OString::number(0));
+    }
 
     sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->getBodyPrAttrList());
     m_pImpl->setBodyPrAttrList(nullptr);


More information about the Libreoffice-commits mailing list