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

New commits:
commit bcfb8c79768a2d3008bfe88b8c1f504f4030f957
Author: Michael Stahl <mst...@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 <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@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("");
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to