[BUGFIX] Add type check to prevent error if backend user is null 37/50337/4
authorMarc Willmann <mw@f7.de>
Mon, 24 Oct 2016 12:19:56 +0000 (14:19 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 24 Oct 2016 21:13:36 +0000 (23:13 +0200)
$backendUser may be null, this would cause an error. Add an
additional type check to prevent this.

Resolves: #78392
Releases: master
Change-Id: Ifa2b2f30283f5740a60edddb5670be9291706f90
Reviewed-on: https://review.typo3.org/50337
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Backend/Avatar/Avatar.php

index 06625d6..4b4a4ae 100644 (file)
@@ -92,7 +92,10 @@ class Avatar
             $backendUser = $this->getBackendUser()->user;
         }
 
-        $avatarImage = $this->getImage($backendUser, $size);
+        $avatarImage = false;
+        if ($backendUser !== null) {
+            $avatarImage = $this->getImage($backendUser, $size);
+        }
 
         if (!$avatarImage) {
             $avatarImage = GeneralUtility::makeInstance(