Fixed a crash when searching recursively through a directory.

This commit is contained in:
Leon Styhre 2020-11-10 22:16:30 +01:00
parent 0bb8737211
commit cc87084959

View file

@ -73,8 +73,10 @@ namespace Utils
std::string fullName(getGenericPath(path + "/" + name)); std::string fullName(getGenericPath(path + "/" + name));
contentList.push_back(fullName); contentList.push_back(fullName);
if (_recursive && isDirectory(fullName)) if (_recursive && isDirectory(fullName)) {
contentList.sort();
contentList.merge(getDirContent(fullName, true)); contentList.merge(getDirContent(fullName, true));
}
} }
} }
while (FindNextFileW(hFind, &findData)); while (FindNextFileW(hFind, &findData));
@ -94,8 +96,10 @@ namespace Utils
std::string fullName(getGenericPath(path + "/" + name)); std::string fullName(getGenericPath(path + "/" + name));
contentList.push_back(fullName); contentList.push_back(fullName);
if (_recursive && isDirectory(fullName)) if (_recursive && isDirectory(fullName)) {
contentList.sort();
contentList.merge(getDirContent(fullName, true)); contentList.merge(getDirContent(fullName, true));
}
} }
} }
closedir(dir); closedir(dir);