From ca5d72e6b0fb5d2b50bc20bd8f624a58bf0e4478 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 29 Jan 2016 15:39:39 +0100 Subject: Catch potential exceptions when accessing the users avatar - e.g. issues with the encrypted file system - fixes #21983 --- apps/dav/lib/carddav/converter.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/dav/lib/carddav/converter.php b/apps/dav/lib/carddav/converter.php index 06d3cb4f18e..c8d9b94c267 100644 --- a/apps/dav/lib/carddav/converter.php +++ b/apps/dav/lib/carddav/converter.php @@ -39,7 +39,7 @@ class Converter { $displayName = empty($displayName ) ? $uid : $displayName; $emailAddress = $user->getEMailAddress(); $cloudId = $user->getCloudId(); - $image = $user->getAvatarImage(-1); + $image = $this->getAvatarImage($user); $vCard = new VCard(); $vCard->add(new Text($vCard, 'UID', $uid)); @@ -72,7 +72,7 @@ class Converter { $displayName = empty($displayName ) ? $uid : $displayName; $emailAddress = $user->getEMailAddress(); $cloudId = $user->getCloudId(); - $image = $user->getAvatarImage(-1); + $image = $this->getAvatarImage($user); $updated = false; if($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) { @@ -155,4 +155,17 @@ class Converter { return $result; } + /** + * @param IUser $user + * @return null|IImage + */ + private function getAvatarImage(IUser $user) { + try { + $image = $user->getAvatarImage(-1); + return $image; + } catch (\Exception $ex) { + return null; + } + } + } -- cgit v1.2.3