summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-08-15 23:12:58 +0200
committerMichael Stahl <mstahl@redhat.com>2017-08-15 23:19:19 +0200
commite026cf6e2f215cdf93a4cab331f0f1f292beb9d3 (patch)
treef6b0772cfb55e6376d264267d575e7dcca55b7c1 /xmloff
parent01bca61907433705950cdd78734851ac41def493 (diff)
xmloff: fix crash on exporting non-loadable external image URL
As seen on exporting rhbz739243-1.odt, the xGraphic is null in that case. (regression from 4469b29faeb8dbf7793a5d81d9c5ddebacf3015f) Change-Id: I535d67eeddc1b9bdf2562fc3b54a97e38ab0354c
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparae.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 361d968f696a..b8f4f09d7e0b 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3024,9 +3024,12 @@ static OUString getMimeType(const OUString& sImageUrl)
Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties ) );
OUString aSourceMimeType;
- Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW );
- if ( xGraphicPropertySet->getPropertyValue( "MimeType" ) >>= aSourceMimeType )
+ Reference<XPropertySet> const xGraphicPropertySet(xGraphic, UNO_QUERY);
+ if (xGraphicPropertySet.is() && // it's null if it's an external link
+ (xGraphicPropertySet->getPropertyValue("MimeType") >>= aSourceMimeType))
+ {
return aSourceMimeType;
+ }
return OUString("");
}