]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(CalDAV): check voject exists before attempting any operation 40081/head
authorAnna Larch <anna@nextcloud.com>
Fri, 30 Jun 2023 09:01:22 +0000 (11:01 +0200)
committerAnna Larch <anna@nextcloud.com>
Mon, 28 Aug 2023 16:49:44 +0000 (18:49 +0200)
Signed-off-by: Anna Larch <anna@nextcloud.com>
lib/private/Calendar/Manager.php

index 7ef9dc585ae3c24a197336add93e3f1855ca96b2..85a600e1cc8540ce30523b063219a5e85dae3750 100644 (file)
@@ -240,12 +240,26 @@ class Manager implements IManager {
        /**
         * @throws \OCP\DB\Exception
         */
-       public function handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData): bool {
-               /** @var VCalendar $vObject */
+       public function handleIMipReply(
+               string $principalUri,
+               string $sender,
+               string $recipient,
+               string $calendarData,
+       ): bool {
+               /** @var VCalendar $vObject|null */
                $vObject = Reader::read($calendarData);
-               /** @var VEvent $vEvent */
+
+               if ($vObject === null) {
+                       return false;
+               }
+
+               /** @var VEvent|null $vEvent */
                $vEvent = $vObject->{'VEVENT'};
 
+               if ($vEvent === null) {
+                       return false;
+               }
+
                // First, we check if the correct method is passed to us
                if (strcasecmp('REPLY', $vObject->{'METHOD'}->getValue()) !== 0) {
                        $this->logger->warning('Wrong method provided for processing');
@@ -309,11 +323,27 @@ class Manager implements IManager {
         * @since 25.0.0
         * @throws \OCP\DB\Exception
         */
-       public function handleIMipCancel(string $principalUri, string $sender, ?string $replyTo, string $recipient, string $calendarData): bool {
+       public function handleIMipCancel(
+               string $principalUri,
+               string $sender,
+               ?string $replyTo,
+               string $recipient,
+               string $calendarData,
+       ): bool {
+               /** @var VCalendar $vObject|null */
                $vObject = Reader::read($calendarData);
-               /** @var VEvent $vEvent */
+
+               if ($vObject === null) {
+                       return false;
+               }
+
+               /** @var VEvent|null $vEvent */
                $vEvent = $vObject->{'VEVENT'};
 
+               if ($vEvent === null) {
+                       return false;
+               }
+
                // First, we check if the correct method is passed to us
                if (strcasecmp('CANCEL', $vObject->{'METHOD'}->getValue()) !== 0) {
                        $this->logger->warning('Wrong method provided for processing');