diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-22 08:35:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-22 14:23:26 +0200 |
commit | 5e752b318e4235d84f8da78bc52689aeb76d033c (patch) | |
tree | 201a7709c86adc796e37a3568d2a7a85c04b2c9b | |
parent | 4d02e8e96bc11bd57da4a06109a1f1f13130f2a4 (diff) |
cid#705118 Using invalid iterator
Change-Id: If90375ee49e71357482f86e31185c95774aef17c
Reviewed-on: https://gerrit.libreoffice.org/76092
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchyprovider.cxx | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index 022f6ec7beb5..be2ae768a041 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -208,7 +208,6 @@ HierarchyContentProvider::getConfigProvider( return (*it).second.xConfigProvider; } - uno::Reference< container::XHierarchicalNameAccess > HierarchyContentProvider::getRootConfigReadNameAccess( const OUString & rServiceSpecifier ) @@ -216,57 +215,56 @@ HierarchyContentProvider::getRootConfigReadNameAccess( osl::MutexGuard aGuard( m_aMutex ); ConfigProviderMap::iterator it = m_aConfigProviderMap.find( rServiceSpecifier ); - if ( it != m_aConfigProviderMap.end() ) + if (it == m_aConfigProviderMap.end()) + return uno::Reference< container::XHierarchicalNameAccess >(); + + if ( !( (*it).second.xRootReadAccess.is() ) ) { - if ( !( (*it).second.xRootReadAccess.is() ) ) + if ( (*it).second.bTriedToGetRootReadAccess ) { - if ( (*it).second.bTriedToGetRootReadAccess ) - { - OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - " - "Unable to read any config data! -> #82494#" ); - return uno::Reference< container::XHierarchicalNameAccess >(); - } + OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - " + "Unable to read any config data! -> #82494#" ); + return uno::Reference< container::XHierarchicalNameAccess >(); + } - try - { - uno::Reference< lang::XMultiServiceFactory > xConfigProv - = getConfigProvider( rServiceSpecifier ); - - if ( xConfigProv.is() ) - { - uno::Sequence< uno::Any > aArguments( 1 ); - beans::PropertyValue aProperty; - aProperty.Name = "nodepath" ; - aProperty.Value <<= OUString(); // root path - aArguments[ 0 ] <<= aProperty; - - (*it).second.bTriedToGetRootReadAccess = true; - - (*it).second.xRootReadAccess.set( - xConfigProv->createInstanceWithArguments( - "com.sun.star.ucb.HierarchyDataReadAccess", - aArguments ), - uno::UNO_QUERY ); - } - } - catch ( uno::RuntimeException const & ) + try + { + uno::Reference< lang::XMultiServiceFactory > xConfigProv + = getConfigProvider( rServiceSpecifier ); + + if ( xConfigProv.is() ) { - throw; + uno::Sequence< uno::Any > aArguments( 1 ); + beans::PropertyValue aProperty; + aProperty.Name = "nodepath" ; + aProperty.Value <<= OUString(); // root path + aArguments[ 0 ] <<= aProperty; + + (*it).second.bTriedToGetRootReadAccess = true; + + (*it).second.xRootReadAccess.set( + xConfigProv->createInstanceWithArguments( + "com.sun.star.ucb.HierarchyDataReadAccess", + aArguments ), + uno::UNO_QUERY ); } - catch ( uno::Exception const & ) - { - // createInstance, createInstanceWithArguments + } + catch ( uno::RuntimeException const & ) + { + throw; + } + catch ( uno::Exception const & ) + { + // createInstance, createInstanceWithArguments - OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - " - "caught Exception!" ); - } + OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - " + "caught Exception!" ); } } return (*it).second.xRootReadAccess; } - uno::Reference< util::XOfficeInstallationDirectories > HierarchyContentProvider::getOfficeInstallationDirectories() { |