diff --git a/Classes/Controller/PageViewController.php b/Classes/Controller/PageViewController.php index 2d9122216..286ca0222 100644 --- a/Classes/Controller/PageViewController.php +++ b/Classes/Controller/PageViewController.php @@ -140,8 +140,11 @@ public function mainAction(): void $this->addViewerJS(); - $this->view->assign('docCount', count($this->documentArray)); - $this->view->assign('docArray', $this->documentArray); + if ($this->documentArray !== null) { + $this->view->assign('docCount', count($this->documentArray)); + $this->view->assign('docArray', $this->documentArray); + } + $this->view->assign('docPage', $this->requestData['docPage']); $this->view->assign('docType', $this->document->getCurrentDocument()->tableOfContents[0]['type']); @@ -462,7 +465,7 @@ protected function getFulltext(int $page): array */ protected function addViewerJS(): void { - if (count($this->documentArray) > 1) { + if ($this->documentArray !== null && count($this->documentArray) > 1) { $jsViewer = 'tx_dlf_viewer = [];'; $i = 0; foreach ($this->documentArray as $document) {