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>
This commit is contained in:
Caolán McNamara
2019-07-22 08:35:18 +01:00
parent 4d02e8e96b
commit 5e752b318e

View File

@@ -208,7 +208,6 @@ HierarchyContentProvider::getConfigProvider(
return (*it).second.xConfigProvider; return (*it).second.xConfigProvider;
} }
uno::Reference< container::XHierarchicalNameAccess > uno::Reference< container::XHierarchicalNameAccess >
HierarchyContentProvider::getRootConfigReadNameAccess( HierarchyContentProvider::getRootConfigReadNameAccess(
const OUString & rServiceSpecifier ) const OUString & rServiceSpecifier )
@@ -216,57 +215,56 @@ HierarchyContentProvider::getRootConfigReadNameAccess(
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
ConfigProviderMap::iterator it = m_aConfigProviderMap.find( ConfigProviderMap::iterator it = m_aConfigProviderMap.find(
rServiceSpecifier ); 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 >();
}
try
{
uno::Reference< lang::XMultiServiceFactory > xConfigProv
= getConfigProvider( rServiceSpecifier );
if ( xConfigProv.is() )
{ {
OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - " uno::Sequence< uno::Any > aArguments( 1 );
"Unable to read any config data! -> #82494#" ); beans::PropertyValue aProperty;
return uno::Reference< container::XHierarchicalNameAccess >(); 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 & )
{
throw;
}
catch ( uno::Exception const & )
{
// createInstance, createInstanceWithArguments
try OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - "
{ "caught Exception!" );
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 & )
{
throw;
}
catch ( uno::Exception const & )
{
// createInstance, createInstanceWithArguments
OSL_FAIL( "HierarchyContentProvider::getRootConfigReadNameAccess - "
"caught Exception!" );
}
} }
} }
return (*it).second.xRootReadAccess; return (*it).second.xRootReadAccess;
} }
uno::Reference< util::XOfficeInstallationDirectories > uno::Reference< util::XOfficeInstallationDirectories >
HierarchyContentProvider::getOfficeInstallationDirectories() HierarchyContentProvider::getOfficeInstallationDirectories()
{ {