diff options
-rw-r--r-- | lib/private/Share20/Manager.php | 4 | ||||
-rw-r--r-- | lib/public/Util.php | 7 |
2 files changed, 10 insertions, 1 deletions
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); } /** |