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

Michael Stahl mstahl at redhat.com
Tue Aug 15 21:22:06 UTC 2017


 xmloff/source/text/txtparae.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit e026cf6e2f215cdf93a4cab331f0f1f292beb9d3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 15 23:12:58 2017 +0200

    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

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("");
 }
 


More information about the Libreoffice-commits mailing list