[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - oox/source

Michael Stahl mstahl at redhat.com
Mon Jan 18 07:04:00 PST 2016


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

New commits:
commit 82f03358d2a77a833ebdcbaea8c03782bb2af56b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jan 11 17:16:24 2016 +0100

    oox: getEntryName() could throw a WrongStateException
    
    let's guard against that.
    
    Change-Id: I970fb801a642592d9c23390572867f0e21f03132
    (cherry picked from commit a951d70609fa125def231c3d7579e72c381334f5)
    Reviewed-on: https://gerrit.libreoffice.org/21496
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index b8f758e..7558feb 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1618,15 +1618,24 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
         return *this;
     }
 
-    uno::Reference<beans::XPropertySet> const xParent(
-        uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
-        uno::UNO_QUERY);
-
     uno::Sequence<beans::PropertyValue> grabBag;
-    xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+    OUString entryName;
+    try
+    {
+        uno::Reference<beans::XPropertySet> const xParent(
+            uno::Reference<container::XChild>(xObj, uno::UNO_QUERY_THROW)->getParent(),
+            uno::UNO_QUERY_THROW);
+
+        xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+
+        entryName = uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName();
+    }
+    catch (uno::Exception const& e)
+    {
+        SAL_WARN("oox", "ShapeExport::WriteOLE2Shape: exception: " << e.Message);
+        return *this;
+    }
 
-    OUString const entryName(
-        uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
     OUString progID;
 
     for (auto const& it : grabBag)


More information about the Libreoffice-commits mailing list