diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-11 17:16:24 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-01-18 15:03:26 +0000 |
commit | 82f03358d2a77a833ebdcbaea8c03782bb2af56b (patch) | |
tree | 47168eeeab9f7fd9f7e66c9f9dc5ca705f1aef37 /oox | |
parent | 0408ccd7d058ef5d7ed1198b32689b47c2a53b00 (diff) |
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@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/shapes.cxx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b8f758ea571c..7558feb4d5e3 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) |