diff options
| author | Fabian Vogt <[email protected]> | 2023-01-02 15:02:06 +0100 |
|---|---|---|
| committer | Fabian Vogt <[email protected]> | 2023-01-09 16:21:33 +0100 |
| commit | 50b991323351d886d67df179d5a0998c5a44abd5 (patch) | |
| tree | 08b65b293027d0ed712120d64fa470c2e275cdcd /src/kitemviews | |
| parent | a81b287e7af7db24ff26a659fe599e5a8b290bd1 (diff) | |
Fix size of directories if a subdir fails to open
If opening the directory fails, it returns -1 as size. Don't add that to the
parent's total size.
(cherry picked from commit a6490755ca7d00c964a1349443ba9c06dbb33e50)
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/private/kdirectorycontentscounterworker.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.cpp b/src/kitemviews/private/kdirectorycontentscounterworker.cpp index 9b86cd702..2cbb58730 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.cpp +++ b/src/kitemviews/private/kdirectorycontentscounterworker.cpp @@ -71,7 +71,10 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath, } if (dirEntry->d_type == DT_DIR) { // recursion for dirs - size += walkDir(nameBuf, countHiddenFiles, countDirectoriesOnly, dirEntry, allowedRecursiveLevel - 1).size; + auto subdirResult = walkDir(nameBuf, countHiddenFiles, countDirectoriesOnly, dirEntry, allowedRecursiveLevel - 1); + if (subdirResult.size > 0) { + size += subdirResult.size; + } } } } |
