From 1e649ab8afe65ee4dcd5bc6155853be31fd09c9e Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Tue, 11 Jan 2022 16:52:11 +0100 Subject: [PATCH] Avoid More Warnings --- index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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);