From e5ca1f73a08a05c957b73929cafa748ba82a033c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 10 Jun 2016 18:55:35 +0200 Subject: Clean up uses of Any::getValue() in desktop Change-Id: I20cc2dba64a07012c7d03ab5d2aca56dd8cfb042 --- .../source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'desktop') diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index a440d9ed1722..d3598f3adf04 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -562,8 +563,8 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus ) OUString text; if ( rStatus.hasValue() && !( rStatus >>= text) ) { - if ( rStatus.getValueTypeClass() == uno::TypeClass_EXCEPTION ) - text = static_cast< uno::Exception const *>( rStatus.getValue() )->Message; + if ( auto e = o3tl::tryAccess(rStatus) ) + text = e->Message; if ( text.isEmpty() ) text = ::comphelper::anyToString( rStatus ); // fallback @@ -800,11 +801,13 @@ void ExtensionCmdQueue::Thread::execute() uno::Any exc( ::cppu::getCaughtException() ); OUString msg; deployment::DeploymentException dpExc; - if ((exc >>= dpExc) && - dpExc.Cause.getValueTypeClass() == uno::TypeClass_EXCEPTION) + if (exc >>= dpExc) { - // notify error cause only: - msg = static_cast< uno::Exception const * >( dpExc.Cause.getValue() )->Message; + if (auto e = o3tl::tryAccess(dpExc.Cause)) + { + // notify error cause only: + msg = e->Message; + } } if (msg.isEmpty()) // fallback for debugging purposes msg = ::comphelper::anyToString(exc); -- cgit