diff --git a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp index 0aeef06267..75a9f1ddbc 100644 --- a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp @@ -202,33 +202,27 @@ int DirectoryContentsList::useTimeSlice() bool DirectoryContentsList::checkNextFile (bool& hasChanged) { - if (fileFindHandle != nullptr) - { - if (*fileFindHandle != RangedDirectoryIterator()) - { - const auto entry = *(*fileFindHandle)++; - - if (addFile (entry.getFile(), - entry.isDirectory(), - entry.getFileSize(), - entry.getModificationTime(), - entry.getCreationTime(), - entry.isReadOnly())) - { - hasChanged = true; - } - - return true; - } + if (fileFindHandle == nullptr) + return false; + if (*fileFindHandle == RangedDirectoryIterator()) + { fileFindHandle = nullptr; isSearching = false; - - if (! wasEmpty && files.isEmpty()) - hasChanged = true; + hasChanged = true; + return false; } - return false; + const auto entry = *(*fileFindHandle)++; + + hasChanged |= addFile (entry.getFile(), + entry.isDirectory(), + entry.getFileSize(), + entry.getModificationTime(), + entry.getCreationTime(), + entry.isReadOnly()); + + return true; } bool DirectoryContentsList::addFile (const File& file, const bool isDir,