[BUGFIX] Check for valid BEuser record for avatar creation 58/51058/3
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 29 Dec 2016 12:14:42 +0000 (13:14 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 29 Dec 2016 15:57:45 +0000 (16:57 +0100)
A not valid BeUser record can not be retrieved from DB and must
not be passed to the AvatarViewHelper render() method to avoid
errors.

Resolves: #79104
Releases: master
Change-Id: I99ffedf9704f87b71e6ebeacc7136c31b0300fe4
Reviewed-on: https://review.typo3.org/51058
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/ViewHelpers/AvatarViewHelper.php

index 5826ecd..70aa038 100644 (file)
@@ -72,6 +72,10 @@ class AvatarViewHelper extends AbstractViewHelper
         } else {
             $backendUser = $GLOBALS['BE_USER']->user;
         }
+        if ($backendUser === false) {
+            // no BE user can be retrieved from DB, probably deleted
+            return '';
+        }
         /** @var Avatar $avatar */
         $avatar = GeneralUtility::makeInstance(Avatar::class);
         return $avatar->render($backendUser, $arguments['size'], $arguments['showIcon']);