From 28d070730d9de5aec690f152a95dbf1da123d2ee Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 3 May 2016 14:05:51 +0200 Subject: [PATCH] Fix case with no user --- lib/private/Share20/Manager.php | 4 ++++ lib/public/Util.php | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 2b1c7d828f1..e2730f4d5fb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1212,6 +1212,10 @@ class Manager implements IManager { * @return bool */ public function sharingDisabledForUser($userId) { + if ($userId === null) { + return false; + } + if (isset($this->sharingDisabledForUsersCache[$userId])) { return $this->sharingDisabledForUsersCache[$userId]; } diff --git a/lib/public/Util.php b/lib/public/Util.php index 86f84565218..687f4e78f69 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -181,7 +181,12 @@ class Util { self::$shareManager = \OC::$server->getShareManager(); } - return self::$shareManager->sharingDisabledForUser(\OC::$server->getUserSession()->getUser()->getUID()); + $user = \OC::$server->getUserSession()->getUser(); + if ($user !== null) { + $user = $user->getUID(); + } + + return self::$shareManager->sharingDisabledForUser($user); } /** -- 2.39.5