sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit aa2b46b323837a0b48b23d7344f361bb88d770fa
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Oct 22 17:01:56 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Oct 23 21:05:39 2024 +0200

    tdf#161359 fix opening RTF with broken images
    
    The try/catch block prevents an exception that looks like
       com.sun.star.lang.IllegalArgumentException message:
       "at 
/Users/noelgrandin/lode/dev/core/svx/source/unodraw/unoshap2.cxx:1423"
    which is inside
       SvxGraphicObject::setPropertyValueImpl
    
    Not sure where would be a better place to handle this.
    
    regression from
        commit 060b0fb4b93ee09770ed9398cca46e365dda5be8
        Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
        Date:   Thu Mar 8 16:37:46 2018 +0900
        change RTFDocumentImpl to use Graphic instead of GraphicURL
    
    Change-Id: Iec3df20a2192df2bf595293037c8214fea151ae3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175418
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 100e0a0163482645b50da21320bb67aeb2dc21fa)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175436
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx 
b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
index 51d7cf5c66d3..431bdb60d90d 100644
--- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
@@ -1024,7 +1024,15 @@ void RTFDocumentImpl::resolvePict(bool const bInline, 
uno::Reference<drawing::XS
     uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
 
     if (xPropertySet.is())
-        xPropertySet->setPropertyValue(u"Graphic"_ustr, uno::Any(xGraphic));
+        // try..catch is for tdf#161359
+        try
+        {
+            xPropertySet->setPropertyValue(u"Graphic"_ustr, 
uno::Any(xGraphic));
+        }
+        catch (const css::uno::Exception&)
+        {
+            DBG_UNHANDLED_EXCEPTION("sw");
+        }
 
     // check if the picture is in an OLE object and if the \objdata element is 
used
     // (see RTFKeyword::OBJECT in RTFDocumentImpl::dispatchDestination)

Reply via email to