From 12e24ed6e706e78190ebea1d95a7927f097003e0 Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Fri, 11 Jan 2019 09:46:55 +0100
Subject: [PATCH] Check for no longer existing calendars

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 apps/dav/lib/Migration/RemoveClassifiedEventActivity.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
index 1f1edf285ac..ad840d8100e 100644
--- a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
+++ b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
@@ -75,6 +75,10 @@ class RemoveClassifiedEventActivity implements IRepairStep {
 		$result = $query->execute();
 
 		while ($row = $result->fetch()) {
+			if ($row['principaluri'] === null) {
+				continue;
+			}
+
 			$delete->setParameter('owner', $this->getPrincipal($row['principaluri']))
 				->setParameter('type', 'calendar')
 				->setParameter('calendar_id', $row['calendarid'])
@@ -105,6 +109,10 @@ class RemoveClassifiedEventActivity implements IRepairStep {
 		$result = $query->execute();
 
 		while ($row = $result->fetch()) {
+			if ($row['principaluri'] === null) {
+				continue;
+			}
+
 			$delete->setParameter('owner', $this->getPrincipal($row['principaluri']))
 				->setParameter('type', 'calendar')
 				->setParameter('calendar_id', $row['calendarid'])
-- 
GitLab