oox/source/export/shapes.cxx |   23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 0e8c798a7f250f01146b21f371385cef19fde73f
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Nov 27 10:06:53 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Nov 27 12:15:57 2025 +0100

    avoid some unnecessary exception throw/catch as control flow
    
    Change-Id: I8aedd3ba5234805d0d93b5a34cc87eb83edd5f9a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194677
    Tested-by: Jenkins
    Tested-by: Noel Grandin <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>
    Code-Style: Noel Grandin <[email protected]>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7af4392377b7..695e06272b60 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2840,20 +2840,17 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 
     uno::Sequence<beans::PropertyValue> grabBag;
     OUString entryName;
-    try
+    uno::Reference<container::XChild> xChild(xObj, uno::UNO_QUERY);
+    if (xChild)
     {
-        uno::Reference<beans::XPropertySet> const xParent(
-            uno::Reference<container::XChild>(xObj, 
uno::UNO_QUERY_THROW)->getParent(),
-            uno::UNO_QUERY_THROW);
-
-        xParent->getPropertyValue(u"InteropGrabBag"_ustr) >>= grabBag;
-
-        entryName = uno::Reference<embed::XEmbedPersist>(xObj, 
uno::UNO_QUERY_THROW)->getEntryName();
-    }
-    catch (uno::Exception const&)
-    {
-        TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLE2Shape");
-        return *this;
+        uno::Reference<beans::XPropertySet> const xParent(xChild->getParent(), 
uno::UNO_QUERY);
+        if (xParent)
+        {
+            xParent->getPropertyValue(u"InteropGrabBag"_ustr) >>= grabBag;
+            uno::Reference<embed::XEmbedPersist> xEmbedPersist(xObj, 
uno::UNO_QUERY);
+            if (xEmbedPersist)
+                entryName = xEmbedPersist->getEntryName();
+        }
     }
 
     OUString progID;

Reply via email to