From f9832ff3475a1feec9d8b8d2d42bbf56d72c0118 Mon Sep 17 00:00:00 2001 From: Juan Pablo Villafáñez Date: Tue, 14 Mar 2017 17:08:05 +0100 Subject: Check if the user exists before trying to set the quota Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/User.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 7a840de87f6..392cb2e51ba 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -498,11 +498,16 @@ class User { } } - if($quota !== false) { - $this->userManager->get($this->uid)->setQuota($quota); + $targetUser = $this->userManager->get($this->uid); + if ($targetUser) { + if($quota !== false) { + $targetUser->setQuota($quota); + } else { + $this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN); + $targetUser->setQuota('default'); + } } else { - $this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN); - $this->userManager->get($this->uid)->setQuota('default'); + $this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', \OCP\Util::ERROR); } } -- cgit v1.2.3