diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-06-05 21:27:07 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-06-24 12:52:29 +0000 |
commit | 7ed79c4a3b35a016be6c3d540725512eaf2e0bba (patch) | |
tree | 515a5b18d5ae9034c7f30e9d5ed7917a11f02598 /xmlhelp | |
parent | 31a6ebe912305eff610d91497831e6ddd213f964 (diff) |
xmlhelp: fix reading symlinked .tree files
Apparently the .tree files nowadays are symlinked, which was not the
case on the libreoffice-4-0 branch... and on viewing the Contents tab
it's evident we can't actually read symlinked .tree files, and crash
with an STL assert because the children vector is empty.
Change-Id: I5a543ef85b827e194120530a486cf19a76837d87
(cherry picked from commit 3ddf70dc1129e9b2294b582256c657305bbf3b3e)
Reviewed-on: https://gerrit.libreoffice.org/4479
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 83ebfd7ca012..01ef477e9311 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -545,6 +545,11 @@ TVChildTarget::~TVChildTarget() void TVChildTarget::Check(TVDom* tvDom) { + if (tvDom->children.empty()) + { + return; + } + unsigned i = 0; bool h = false; @@ -807,7 +812,8 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) } osl::Directory aDirectory( url ); - osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileSize | osl_FileStatus_Mask_FileURL ); + osl::FileStatus aFileStatus( + osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL ); if( osl::Directory::E_None == aDirectory.open() ) { int idx_ = 0; @@ -831,18 +837,17 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) ( str[idx_ + 3] == 'e' || str[idx_ + 3] == 'E' ) && ( str[idx_ + 4] == 'e' || str[idx_ + 4] == 'E' ) ) { - OSL_ENSURE( aFileStatus.isValid( osl_FileStatus_Mask_FileSize ), - "invalid file size" ); - OUString baseName = aFileName.copy(0,idx_).toAsciiLowerCase(); if(! showBasic && baseName.compareToAscii("sbasic") == 0 ) continue; osl::File aFile( aFileUrl ); if( osl::FileBase::E_None == aFile.open( osl_File_OpenFlag_Read ) ) { + // use the file size, not aFileStatus size, in case the + // tree file is a symlink sal_uInt64 nSize; aFile.getSize( nSize ); - configData.vFileLen.push_back( aFileStatus.getFileSize() ); + configData.vFileLen.push_back( nSize ); configData.vFileURL.push_back( aFileUrl ); aFile.close(); } |