From 40e7b83b5092d12983203e9c121f0df015087e1b Mon Sep 17 00:00:00 2001 From: proggeler Date: Thu, 16 Jan 2020 16:00:51 +0100 Subject: [PATCH] #185: fixed fatal error whilst generating html --- libs/Tree/Directory.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/Tree/Directory.php b/libs/Tree/Directory.php index 7ab4451..1534c4a 100644 --- a/libs/Tree/Directory.php +++ b/libs/Tree/Directory.php @@ -151,8 +151,10 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate */ public function getIndexPage(): ?Content { - if ($this->getLocalIndexPage()) { - return $this->getLocalIndexPage(); + $indexPage = $this->getLocalIndexPage(); + + if ($indexPage instanceof Content) { + return $indexPage; } if ($this->getConfig()->shouldInheritIndex() && $first_page = $this->seekFirstPage()) { @@ -170,7 +172,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate { if ($this instanceof self) { $index_key = $this->getConfig()->getIndexKey(); - if (isset($this->children[$index_key])) { + if (isset($this->children[$index_key]) && $this->children[$index_key] instanceof Content) { return $this->children[$index_key]; } foreach ($this->children as $node_key => $node) {