summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/hookmanager.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/hookmanager.php')
-rw-r--r--apps/dav/lib/hookmanager.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/dav/lib/hookmanager.php b/apps/dav/lib/hookmanager.php
index 4a4704ff2a2..687e6718db3 100644
--- a/apps/dav/lib/hookmanager.php
+++ b/apps/dav/lib/hookmanager.php
@@ -100,26 +100,26 @@ class HookManager {
public function postLogin($params) {
$user = $this->userManager->get($params['uid']);
-
- $principal = 'principals/users/' . $user->getUID();
- $calendars = $this->calDav->getCalendarsForUser($principal);
- if (empty($calendars)) {
- try {
- $this->calDav->createCalendar($principal, 'personal', [
- 'displayname' => 'Personal']);
- } catch (\Exception $ex) {
- \OC::$server->getLogger()->logException($ex);
+ if (!is_null($user)) {
+ $principal = 'principals/users/' . $user->getUID();
+ $calendars = $this->calDav->getCalendarsForUser($principal);
+ if (empty($calendars)) {
+ try {
+ $this->calDav->createCalendar($principal, 'personal', [
+ '{DAV:}displayname' => 'Personal']);
+ } catch (\Exception $ex) {
+ \OC::$server->getLogger()->logException($ex);
+ }
}
- }
- $books = $this->cardDav->getAddressBooksForUser($principal);
- if (empty($books)) {
- try {
- $this->cardDav->createAddressBook($principal, 'contacts', [
- 'displayname' => 'Contacts']);
- } catch (\Exception $ex) {
- \OC::$server->getLogger()->logException($ex);
+ $books = $this->cardDav->getAddressBooksForUser($principal);
+ if (empty($books)) {
+ try {
+ $this->cardDav->createAddressBook($principal, 'contacts', [
+ '{DAV:}displayname' => 'Contacts']);
+ } catch (\Exception $ex) {
+ \OC::$server->getLogger()->logException($ex);
+ }
}
}
-
}
}