diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2000-12-03 19:13:07 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2000-12-03 19:13:07 (GMT) |
commit | 5167cf2076e30ed3f6ddd84b76543a0dff207496 (patch) | |
tree | 485fb83c5a301dd4b0edb3c534b1f31eeb08ab1f /qtools/qdir_unix.cpp | |
parent | a1995ea7b217edfe0a6ddf3d60ea7bde1e23c1d7 (diff) | |
download | Doxygen-5167cf2076e30ed3f6ddd84b76543a0dff207496.zip Doxygen-5167cf2076e30ed3f6ddd84b76543a0dff207496.tar.gz Doxygen-5167cf2076e30ed3f6ddd84b76543a0dff207496.tar.bz2 |
Release-1.2.3-20001203
Diffstat (limited to 'qtools/qdir_unix.cpp')
-rw-r--r-- | qtools/qdir_unix.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/qtools/qdir_unix.cpp b/qtools/qdir_unix.cpp index 3b12de9..46a3b69 100644 --- a/qtools/qdir_unix.cpp +++ b/qtools/qdir_unix.cpp @@ -243,23 +243,25 @@ bool QDir::readDirEntries( const QString &nameFilter, } // Sort... - QDirSortItem* si= new QDirSortItem[fiList->count()]; - QFileInfo* itm; - i=0; - for (itm = fiList->first(); itm; itm = fiList->next()) - si[i++].item = itm; - qt_cmp_si_sortSpec = sortSpec; - qsort( si, i, sizeof(si[0]), qt_cmp_si ); - // put them back in the list - fiList->setAutoDelete( FALSE ); - fiList->clear(); - int j; - for ( j=0; j<i; j++ ) { - fiList->append( si[j].item ); - fList->append( si[j].item->fileName() ); + if(fiList->count()) { + QDirSortItem* si= new QDirSortItem[fiList->count()]; + QFileInfo* itm; + i=0; + for (itm = fiList->first(); itm; itm = fiList->next()) + si[i++].item = itm; + qt_cmp_si_sortSpec = sortSpec; + qsort( si, i, sizeof(si[0]), qt_cmp_si ); + // put them back in the list + fiList->setAutoDelete( FALSE ); + fiList->clear(); + int j; + for ( j=0; j<i; j++ ) { + fiList->append( si[j].item ); + fList->append( si[j].item->fileName() ); + } + delete [] si; + fiList->setAutoDelete( TRUE ); } - delete [] si; - fiList->setAutoDelete( TRUE ); if ( filterSpec == (FilterSpec)filtS && sortSpec == (SortSpec)sortS && nameFilter == nameFilt ) |