diff options
author | Cédric Neukom <github@webguy.ch> | 2022-07-17 18:36:06 +0200 |
---|---|---|
committer | Cédric Neukom <github@webguy.ch> | 2022-07-17 18:36:06 +0200 |
commit | 9eb276b20b051c31b349671600961c60d94ad175 (patch) | |
tree | 9da03b437546663e8259f6173807a2c656e04747 | |
parent | 483549d22afad37257b6aa393e0f83a40ae97a61 (diff) | |
download | nextcloud-server-9eb276b20b051c31b349671600961c60d94ad175.tar.gz nextcloud-server-9eb276b20b051c31b349671600961c60d94ad175.zip |
fix possibly null variables
Signed-off-by: Cédric Neukom <github@webguy.ch>
-rw-r--r-- | apps/dav/lib/CalDAV/BirthdayService.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index f7fef03dddb..87e33006095 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -14,6 +14,7 @@ declare(strict_types=1); * @author Sven Strickroth <email@cs-ware.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Valdnet <47037905+Valdnet@users.noreply.github.com> + * @author Cédric Neukom <github@webguy.ch> * * @license AGPL-3.0 * @@ -86,6 +87,9 @@ class BirthdayService { $targetPrincipals = $this->getAllAffectedPrincipals($addressBookId); $book = $this->cardDavBackEnd->getAddressBookById($addressBookId); + if ($book === null) { + return; + } $targetPrincipals[] = $book['principaluri']; $datesToSync = [ ['postfix' => '', 'field' => 'BDAY'], @@ -101,6 +105,9 @@ class BirthdayService { $reminderOffset = $this->getReminderOffsetForUser($principalUri); $calendar = $this->ensureCalendarExists($principalUri); + if ($calendar === null) { + return; + } foreach ($datesToSync as $type) { $this->updateCalendar($cardUri, $cardData, $book, (int) $calendar['id'], $type, $reminderOffset); } @@ -356,7 +363,7 @@ class BirthdayService { array $book, int $calendarId, array $type, - string $reminderOffset):void { + ?string $reminderOffset):void { $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix'], $reminderOffset); $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); |