diff options
author | Noel Power <noel.power@novell.com> | 2012-04-17 15:50:35 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-04-17 15:52:27 +0100 |
commit | 45b57a9dfb5df8b9c4a1974cb6e848d4f3b57ea3 (patch) | |
tree | daf46f83a036ba7197213f6ab1def7f40db49aa3 | |
parent | cf1e3b9132a804bd5d7eb0294c1d7e4f0254f52b (diff) |
prevent getFileURL() & getLinkTargetURL() asserting for broken links
-rw-r--r-- | ucb/source/ucp/file/shell.cxx | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 1cb03b32e141..1907d168cb12 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -2491,54 +2491,57 @@ shell::getv( osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL ); - aDirItem.getFileStatus( aFileStatus ); - aUnqPath = aFileStatus.getFileURL(); - // If the directory item type is a link retrieve the type of the target - - if ( aFileStatus.getFileType() == osl::FileStatus::Link ) + osl::FileBase::RC aRes = aDirItem.getFileStatus( aFileStatus ); + if ( aRes == osl::FileBase::E_None ) { - // Assume failure - aIsRegular = false; - osl::FileBase::RC result = osl::FileBase::E_INVAL; - osl::DirectoryItem aTargetItem; - osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem ); - if ( aTargetItem.is() ) + aUnqPath = aFileStatus.getFileURL(); + + // If the directory item type is a link retrieve the type of the target + + if ( aFileStatus.getFileType() == osl::FileStatus::Link ) { - osl::FileStatus aTargetStatus( osl_FileStatus_Mask_Type ); + // Assume failure + aIsRegular = false; + osl::FileBase::RC result = osl::FileBase::E_INVAL; + osl::DirectoryItem aTargetItem; + osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem ); + if ( aTargetItem.is() ) + { + osl::FileStatus aTargetStatus( osl_FileStatus_Mask_Type ); - if ( osl::FileBase::E_None == - ( result = aTargetItem.getFileStatus( aTargetStatus ) ) ) - aIsRegular = - aTargetStatus.getFileType() == osl::FileStatus::Regular; + if ( osl::FileBase::E_None == + ( result = aTargetItem.getFileStatus( aTargetStatus ) ) ) + aIsRegular = + aTargetStatus.getFileType() == osl::FileStatus::Regular; + } } - } - else - aIsRegular = aFileStatus.getFileType() == osl::FileStatus::Regular; + else + aIsRegular = aFileStatus.getFileType() == osl::FileStatus::Regular; - registerNotifier( aUnqPath,pNotifier ); - insertDefaultProperties( aUnqPath ); - { - osl::MutexGuard aGuard( m_aMutex ); + registerNotifier( aUnqPath,pNotifier ); + insertDefaultProperties( aUnqPath ); + { + osl::MutexGuard aGuard( m_aMutex ); - shell::ContentMap::iterator it = m_aContent.find( aUnqPath ); - commit( it,aFileStatus ); + shell::ContentMap::iterator it = m_aContent.find( aUnqPath ); + commit( it,aFileStatus ); - shell::PropertySet::iterator it1; - PropertySet& propset = *(it->second.properties); + shell::PropertySet::iterator it1; + PropertySet& propset = *(it->second.properties); - for( sal_Int32 i = 0; i < seq.getLength(); ++i ) - { - MyProperty readProp( properties[i].Name ); - it1 = propset.find( readProp ); - if( it1 == propset.end() ) - seq[i] = uno::Any(); - else - seq[i] = it1->getValue(); + for( sal_Int32 i = 0; i < seq.getLength(); ++i ) + { + MyProperty readProp( properties[i].Name ); + it1 = propset.find( readProp ); + if( it1 == propset.end() ) + seq[i] = uno::Any(); + else + seq[i] = it1->getValue(); + } } + deregisterNotifier( aUnqPath,pNotifier ); } - deregisterNotifier( aUnqPath,pNotifier ); - XRow_impl* p = new XRow_impl( this,seq ); return uno::Reference< sdbc::XRow >( p ); } |