summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-06-05 21:27:07 +0200
committerMichael Stahl <mstahl@redhat.com>2013-06-06 11:08:31 +0200
commit3ddf70dc1129e9b2294b582256c657305bbf3b3e (patch)
tree2b4732cfc99432babbdd92e7f8e9fd7ce4e3f9e7 /xmlhelp
parente9ac56d4d96d26de9d63d512ba1bd650939bbf60 (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
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/treeview/tvread.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 8a2d494d4cbe..d96d4a5e98ad 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -546,6 +546,11 @@ TVChildTarget::~TVChildTarget()
void TVChildTarget::Check(TVDom* tvDom)
{
+ if (tvDom->children.empty())
+ {
+ return;
+ }
+
unsigned i = 0;
bool h = false;
@@ -808,7 +813,8 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
}
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;
@@ -832,18 +838,17 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
( 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();
}