From b63a6a4fc4bdd0df7118f6478768cc3c3e552668 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 25 Feb 2015 17:20:26 +0100 Subject: 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. Backport of 9ee37169a6615e06c397e3b623ca55805aebcea3 from master --- lib/private/tagmanager.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/private') diff --git a/lib/private/tagmanager.php b/lib/private/tagmanager.php index 6c7eeab87eb..c0ba56a2da8 100644 --- a/lib/private/tagmanager.php +++ b/lib/private/tagmanager.php @@ -76,6 +76,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); -- cgit v1.2.3