[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmloff/source

Michael Stahl mstahl at redhat.com
Wed Aug 16 19:32:50 UTC 2017


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

New commits:
commit bcfb8c79768a2d3008bfe88b8c1f504f4030f957
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
    (cherry picked from commit e026cf6e2f215cdf93a4cab331f0f1f292beb9d3)
    Reviewed-on: https://gerrit.libreoffice.org/41188
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index c9b5acd0897c..49f7ff0706ac 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3044,9 +3044,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