Skip to content

Commit 8143411

Browse files
committed
fix: prevent null pointer errors in get_dir_file_info when get_file_info returns null
1 parent 8c164d0 commit 8143411

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎system/Helpers/filesystem_helper.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r
281281
if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) {
282282
get_dir_file_info($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true);
283283
} elseif ($file[0] !== '.') {
284-
$fileData[$file] = get_file_info($sourceDir . $file);
285-
$fileData[$file]['relative_path'] = $relativePath;
284+
if (($info = get_file_info($sourceDir . $file)) !== null) {
285+
$fileData[$file] = $info;
286+
$fileData[$file]['relative_path'] = $relativePath;
287+
}
286288
}
287289
}
288290

0 commit comments

Comments
 (0)