diff --git a/index.php b/index.php index ab9c165..905f28d 100644 --- a/index.php +++ b/index.php @@ -37,9 +37,11 @@ if (isset($_SESSION['files']) $files = $_SESSION['files']; } else { $tmpdirs = glob(Helpers::end_dir($imagedir.$dir).'*' , GLOB_ONLYDIR); - foreach ($tmpdirs as $tmpdir) - $dirs[] = basename($tmpdir); - $rmdirs = $dirs; + if (!empty($tmpdirs)) { + foreach ($tmpdirs as $tmpdir) + $dirs[] = basename($tmpdir); + $rmdirs = $dirs; + } $rmdirs[] = '.'; $rmdirs[] = '..'; $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs);