Resolves: fdo#85081 terminate if can't load kde addressbook

Change-Id: I3b1b78127d7d4080a23c0ac9f7d37706197de62c
This commit is contained in:
Caolán McNamara 2014-10-28 13:39:08 +00:00
parent aa0499cefd
commit 7acb634f58

View file

@ -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<DriverAccess&>(_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;
}