[TASK] Suppress avatar file resolving if there is none 91/58291/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 16 Sep 2018 08:16:15 +0000 (10:16 +0200)
committerBenni Mack <benni@typo3.org>
Sun, 16 Sep 2018 19:17:50 +0000 (21:17 +0200)
Suppress a where uid=0 call on sys_file table if the
backend user has not avatar assigned.

Resolves: #86273
Releases: master
Change-Id: Id67e80dbb906ce27af3954f9c20ee49a5c7050ee
Reviewed-on: https://review.typo3.org/58291
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
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/Backend/Avatar/DefaultAvatarProvider.php

index 1cf2b58..894b022 100644 (file)
@@ -36,7 +36,10 @@ class DefaultAvatarProvider implements AvatarProviderInterface
     public function getImage(array $backendUser, $size)
     {
         $fileUid = $this->getAvatarFileUid($backendUser['uid']);
-
+        if ($fileUid === 0) {
+            // Early return if there is no valid image file UID
+            return null;
+        }
         // Get file object
         try {
             $file = ResourceFactory::getInstance()->getFileObject($fileUid);