diff options
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 873991a8f998..39a5858ae642 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)); + } } } } |