summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-03-13 13:12:14 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2015-03-13 15:29:52 +0100
commit8304f5f5088077074472d24fe244c82600d2b1a8 (patch)
tree8fde1003f70f23e06b03dd9269ad417ae761385a /core
parentc546f0bf46a51dc297be15aa1acbca5ed9a84de9 (diff)
downloadnextcloud-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.php12
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');