added safeguard against crash in dir_hierarchy

This commit is contained in:
csoler 2021-01-21 18:15:02 +01:00
parent 39a8de9bb9
commit feecf7c763

View File

@ -647,7 +647,8 @@ uint64_t InternalFileHierarchyStorage::recursUpdateCumulatedSize(const Directory
uint64_t local_cumulative_size = 0;
for(uint32_t i=0;i<d.subfiles.size();++i)
local_cumulative_size += static_cast<FileEntry*>(mNodes[d.subfiles[i]])->file_size;
if(mNodes[d.subfiles[i]]) // normally not needed, but an extra-security
local_cumulative_size += static_cast<FileEntry*>(mNodes[d.subfiles[i]])->file_size;
for(uint32_t i=0;i<d.subdirs.size();++i)
local_cumulative_size += recursUpdateCumulatedSize(d.subdirs[i]);