diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-03-13 13:12:14 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-03-13 15:29:52 +0100 |
commit | 8304f5f5088077074472d24fe244c82600d2b1a8 (patch) | |
tree | 8fde1003f70f23e06b03dd9269ad417ae761385a /core | |
parent | c546f0bf46a51dc297be15aa1acbca5ed9a84de9 (diff) | |
download | nextcloud-server-8304f5f5088077074472d24fe244c82600d2b1a8.tar.gz nextcloud-server-8304f5f5088077074472d24fe244c82600d2b1a8.zip |
Fix getting the avatar of a non-existing user
Diffstat (limited to 'core')
-rw-r--r-- | core/avatar/avatarcontroller.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/avatar/avatarcontroller.php b/core/avatar/avatarcontroller.php index dd6e8fdc71d..f63e02b7761 100644 --- a/core/avatar/avatarcontroller.php +++ b/core/avatar/avatarcontroller.php @@ -101,11 +101,13 @@ class AvatarController extends Controller { ['Content-Type' => $image->mimeType()]); $resp->setETag(crc32($image->data())); } else { - $resp = new DataResponse( - ['data' => [ - 'displayname' => $this->userManager->get($userId)->getDisplayName() - ] - ]); + $user = $this->userManager->get($userId); + $userName = $user ? $user->getDisplayName() : ''; + $resp = new DataResponse([ + 'data' => [ + 'displayname' => $userName, + ], + ]); } $resp->addHeader('Pragma', 'public'); |