From 21e2158fa11757e43ccd904bba48553b8caba2ca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 30 Sep 2024 19:16:38 +0200 Subject: [PATCH] remove unnecessary null checks Change-Id: I73805881eef49fc6886f7f4fbc212da3aac1fd6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174290 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/stringresource/stringresource.cxx | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index a081601b42b2..f144fd3bcb32 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -930,7 +930,7 @@ void StringResourcePersistenceImpl::storeToURL( const OUString& URL, std::unique_lock aGuard( m_aMutex ); Reference< ucb::XSimpleFileAccess3 > xFileAccess = ucb::SimpleFileAccess::create(m_xContext); - if( xFileAccess.is() && Handler.is() ) + if( Handler.is() ) xFileAccess->setInteractionHandler( Handler ); implStoreAtLocation( URL, NameBase, Comment, xFileAccess, false/*bUsedForStore*/, true/*bStoreAll*/ ); @@ -2531,7 +2531,7 @@ void StringResourceWithLocationImpl::setURL( const OUString& URL ) void StringResourceWithLocationImpl::implScanLocales() { const Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccessImpl(); - if( xFileAccess.is() && xFileAccess->isFolder( m_aLocation ) ) + if( xFileAccess->isFolder( m_aLocation ) ) { Sequence< OUString > aContentSeq = xFileAccess->getFolderContents( m_aLocation, false ); implScanLocaleNames( aContentSeq ); @@ -2544,23 +2544,20 @@ bool StringResourceWithLocationImpl::implLoadLocale( LocaleItem* pLocaleItem ) bool bSuccess = false; const Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccessImpl(); - if( xFileAccess.is() ) - { - OUString aCompleteFileName = - implGetPathForLocaleItem( pLocaleItem, m_aNameBase, m_aLocation ); + OUString aCompleteFileName = + implGetPathForLocaleItem( pLocaleItem, m_aNameBase, m_aLocation ); - Reference< io::XInputStream > xInputStream; - try - { - xInputStream = xFileAccess->openFileRead( aCompleteFileName ); - } - catch( Exception& ) - {} - if( xInputStream.is() ) - { - bSuccess = StringResourcePersistenceImpl::implReadPropertiesFile( pLocaleItem, xInputStream ); - xInputStream->closeInput(); - } + Reference< io::XInputStream > xInputStream; + try + { + xInputStream = xFileAccess->openFileRead( aCompleteFileName ); + } + catch( Exception& ) + {} + if( xInputStream.is() ) + { + bSuccess = StringResourcePersistenceImpl::implReadPropertiesFile( pLocaleItem, xInputStream ); + xInputStream->closeInput(); } return bSuccess; @@ -2572,7 +2569,7 @@ const Reference< ucb::XSimpleFileAccess3 > & StringResourceWithLocationImpl::get { m_xSFI = ucb::SimpleFileAccess::create(m_xContext); - if( m_xSFI.is() && m_xInteractionHandler.is() ) + if( m_xInteractionHandler.is() ) m_xSFI->setInteractionHandler( m_xInteractionHandler ); } return m_xSFI;