Skip to content

Commit e27fb4a

Browse files
committed
fix: catch empty result for getSizeFast
1 parent ed7adae commit e27fb4a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Components/CacheHelper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ private static function getSizeFast(string $dir): ?int
1717
{
1818
$output = null;
1919
exec('du -s "' . $dir . '"', $output);
20-
if (preg_match('/[0-9]+/', $output[0], $match)) {
20+
21+
if (!isset($output[0])) {
22+
return null;
23+
}
24+
25+
if (preg_match('/\d+/', $output[0], $match)) {
2126
return $match[0] * 1024;
2227
}
2328

0 commit comments

Comments
 (0)