#185: fixed fatal error whilst generating html

This commit is contained in:
proggeler 2020-01-16 16:00:51 +01:00 committed by Stéphane Goetz
parent 3276d4b611
commit 40e7b83b50

View File

@ -151,8 +151,10 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
*/ */
public function getIndexPage(): ?Content public function getIndexPage(): ?Content
{ {
if ($this->getLocalIndexPage()) { $indexPage = $this->getLocalIndexPage();
return $this->getLocalIndexPage();
if ($indexPage instanceof Content) {
return $indexPage;
} }
if ($this->getConfig()->shouldInheritIndex() && $first_page = $this->seekFirstPage()) { if ($this->getConfig()->shouldInheritIndex() && $first_page = $this->seekFirstPage()) {
@ -170,7 +172,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
{ {
if ($this instanceof self) { if ($this instanceof self) {
$index_key = $this->getConfig()->getIndexKey(); $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]; return $this->children[$index_key];
} }
foreach ($this->children as $node_key => $node) { foreach ($this->children as $node_key => $node) {