[Libreoffice-commits] core.git: Branch 'distro/collabora/cd-5.3-3.1' - oox/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Apr 5 08:59:59 UTC 2018


 oox/source/core/xmlfilterbase.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 513dfeee353743cee4e4e2f986bf59672e83865e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Mar 20 22:57:17 2018 -0400

    oox: don't segfault when failing to open a custom fragment
    
    Change-Id: Ie05d1feea2e930b117b3754c6e0db86bdb85bc61
    Reviewed-on: https://gerrit.libreoffice.org/51681
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit f82888653c853f236ab0035bb578a7129ec72fa5)
    Reviewed-on: https://gerrit.libreoffice.org/52227
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 6ac27e7d3deb8e137860d8b31f1c5eace616de53)
    Reviewed-on: https://gerrit.libreoffice.org/52449

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 7caf551c1836..8b8454d4202d 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -1119,13 +1119,16 @@ void XmlFilterBase::exportCustomFragments()
         addRelation(customFragmentTypes[j], customFragmentTargets[j]);
         const OUString aFilename = customFragmentTargets[j];
         Reference<XOutputStream> xOutStream = openOutputStream(aFilename);
-        xOutStream->writeBytes(customFragments[j]);
-        uno::Reference<XPropertySet> xProps(xOutStream, uno::UNO_QUERY);
-        if (xProps.is())
+        if (xOutStream.is())
         {
-            const OUString aType = comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename);
-            const OUString aContentType = (aType.getLength() ? aType : OUString("application/octet-stream"));
-            xProps->setPropertyValue("MediaType", uno::makeAny(aContentType));
+            xOutStream->writeBytes(customFragments[j]);
+            uno::Reference<XPropertySet> xProps(xOutStream, uno::UNO_QUERY);
+            if (xProps.is())
+            {
+                const OUString aType = comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename);
+                const OUString aContentType = (aType.getLength() ? aType : OUString("application/octet-stream"));
+                xProps->setPropertyValue("MediaType", uno::makeAny(aContentType));
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list