From cdc8fca10dfe857b5c54a2da74cd88f2a89b8828 Mon Sep 17 00:00:00 2001
From: Mathias Schreiber <mathias.schreiber@wmdb.de>
Date: Sat, 21 Nov 2015 16:21:10 +0100
Subject: [PATCH] [BUGFIX] Check for BackendTemplateView in IndexedSearch

We need to check for the correct View Object before
working with ModuleTemplate because Extbase initializes a
view even if there is none.

Resolves: #71754
Releases: master
Change-Id: I4e66b7d087af310d0f3dc096b2fc893c8016b92e
Reviewed-on: https://review.typo3.org/44862
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 .../Controller/AdministrationController.php      | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php b/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
index dc931c270115..b132d7a95f5d 100644
--- a/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
+++ b/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
@@ -85,13 +85,15 @@ class AdministrationController extends ActionController
      */
     protected function initializeView(ViewInterface $view)
     {
-        /** @var BackendTemplateView $view */
-        parent::initializeView($view);
-        $permissionClause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
-        $pageRecord = BackendUtility::readPageAccess($this->pageUid, $permissionClause);
-        $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
-        $this->generateMenu();
-        $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
+        if ($view instanceof BackendTemplateView) {
+            /** @var BackendTemplateView $view */
+            parent::initializeView($view);
+            $permissionClause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
+            $pageRecord = BackendUtility::readPageAccess($this->pageUid, $permissionClause);
+            $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
+            $this->generateMenu();
+            $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
+        }
     }
 
     /**
-- 
GitLab