diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-02-25 17:20:26 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-02-25 17:20:26 +0100 |
commit | 9ee37169a6615e06c397e3b623ca55805aebcea3 (patch) | |
tree | 8891548b5acff6c3908904517d01e5eec7958a03 /lib | |
parent | 14c592fe865748f38dd6ee31634d053f83a8e791 (diff) | |
download | nextcloud-server-9ee37169a6615e06c397e3b623ca55805aebcea3.tar.gz nextcloud-server-9ee37169a6615e06c397e3b623ca55805aebcea3.zip |
Return null when requesting tags for null user
The TagManager->load() now returns null if the user is not authenticated
instead of failing with an error.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/tagmanager.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/tagmanager.php b/lib/private/tagmanager.php index 9bc461f25eb..1c7ace11469 100644 --- a/lib/private/tagmanager.php +++ b/lib/private/tagmanager.php @@ -65,6 +65,11 @@ class TagManager implements \OCP\ITagManager { */ public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) { if (is_null($userId)) { + $user = $this->userSession->getUser(); + if ($user === null) { + // nothing we can do without a user + return null; + } $userId = $this->userSession->getUser()->getUId(); } return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared); |