diff options
author | Joas Schilling <coding@schilljs.com> | 2019-08-28 11:51:54 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-08-28 11:51:54 +0300 |
commit | 16c035962a3308217cc3a3f03a8e4ad99c674123 (patch) | |
tree | d831ed2e67c2992ed44e6b142a9224c943863e3a /lib | |
parent | fd6cc4a5487124cbb165fe5bd2a77e9174e5af8c (diff) |
Add a unit test and fix an issue with folders
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Files/Util.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Files/Util.php b/lib/Files/Util.php index fc546e193..331f6d946 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -188,9 +188,12 @@ class Util { $nodes = array_filter($nodes, function(Node $node) { return $node->getType() === FileInfo::TYPE_FILE; }); + if (empty($nodes)) { + return null; + } /** @var Node $node */ - $node = array_pop($nodes); + $node = array_shift($nodes); try { $storage = $node->getStorage(); if ($storage->instanceOfStorage(GroupFolderStorage::class)) { |