From 7acb634f58e86375f4a3cd4926a560679a45896f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 28 Oct 2014 13:39:08 +0000 Subject: Resolves: fdo#85081 terminate if can't load kde addressbook Change-Id: I3b1b78127d7d4080a23c0ac9f7d37706197de62c --- connectivity/source/manager/mdrivermanager.cxx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 494a3043ddc9..6e90f651b31a 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -119,12 +119,26 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W const DriverAccess& operator()( const DriverAccess& _rDescriptor ) const { - if ( !_rDescriptor.xDriver.is() ) - // we did not load this driver, yet - if ( _rDescriptor.xComponentFactory.is() ) - // we have a factory for it - const_cast< DriverAccess& >( _rDescriptor ).xDriver.set( - _rDescriptor.xComponentFactory->createInstanceWithContext( mxContext ), css::uno::UNO_QUERY); + // we did not load this driver, yet + if (!_rDescriptor.xDriver.is()) + { + // we have a factory for it + if (_rDescriptor.xComponentFactory.is()) + { + DriverAccess& rDesc = const_cast(_rDescriptor); + try + { + //load driver + rDesc.xDriver.set( + rDesc.xComponentFactory->createInstanceWithContext(mxContext), css::uno::UNO_QUERY); + } + catch (const Exception&) + { + //failure, abandon driver + rDesc.xComponentFactory.clear(); + } + } + } return _rDescriptor; } -- cgit