summaryrefslogtreecommitdiff
path: root/oox/source/core/xmlfilterbase.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/core/xmlfilterbase.cxx')
-rw-r--r--oox/source/core/xmlfilterbase.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 00d202b315da..58333fb6c229 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -1118,13 +1118,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));
+ }
}
}
}