opendir返回值判空

Signed-off-by: liduo <liduo29@huawei.com>
This commit is contained in:
liduo
2025-09-05 13:54:51 +08:00
parent b0e9a17345
commit c0bfbbbcf5
+3
View File
@@ -84,6 +84,9 @@ const vector<unique_ptr<FileEntry>> FileEntry::GetChilds() const
FindClose(handle);
#else
DIR *handle = opendir(filePath.c_str());
if (handle == nullptr) {
return children;
}
struct dirent *entry;
while ((entry = readdir(handle)) != nullptr) {
string filename(entry->d_name);