[BUGFIX] Properly check if there are open documents 57/57457/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 3 Jul 2018 12:47:02 +0000 (14:47 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 25 Jul 2018 22:04:00 +0000 (00:04 +0200)
The toolbar item for open documents now properly checks whether there are
any open document to avoid actions on a null value. Additionally, the
arrays holding the state are now correctly initialized.

Resolves: #85465
Related: #78051
Releases: 7.6
Change-Id: I2adb52504d8131a695b4775ed21caf813d9657e1
Reviewed-on: https://review.typo3.org/57457
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Alexander Grein <alexander.grein@gmail.com>
Tested-by: Alexander Grein <alexander.grein@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php

index efec702..5fe284b 100644 (file)
@@ -31,12 +31,12 @@ class OpendocsToolbarItem implements ToolbarItemInterface
     /**
      * @var array
      */
-    protected $openDocs;
+    protected $openDocs = [];
 
     /**
      * @var array
      */
-    protected $recentDocs;
+    protected $recentDocs = [];
 
     /**
      * @var IconFactory
@@ -74,8 +74,11 @@ class OpendocsToolbarItem implements ToolbarItemInterface
     public function loadDocsFromUserSession()
     {
         $backendUser = $this->getBackendUser();
-        list($this->openDocs, ) = $backendUser->getModuleData('FormEngine', 'ses');
-        $this->recentDocs = $backendUser->getModuleData('opendocs::recent');
+        $openDocs = $backendUser->getModuleData('FormEngine', 'ses');
+        if ($openDocs !== null) {
+            list($this->openDocs, ) = $openDocs;
+        }
+        $this->recentDocs = $backendUser->getModuleData('opendocs::recent') ?: [];
     }
 
     /**