Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Neukom <github@webguy.ch>2022-07-17 19:36:06 +0300
committerCédric Neukom <github@webguy.ch>2022-07-17 19:36:06 +0300
commit9eb276b20b051c31b349671600961c60d94ad175 (patch)
tree9da03b437546663e8259f6173807a2c656e04747
parent483549d22afad37257b6aa393e0f83a40ae97a61 (diff)
fix possibly null variables
Signed-off-by: Cédric Neukom <github@webguy.ch>
-rw-r--r--apps/dav/lib/CalDAV/BirthdayService.php9
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);