From e37ad6674fce690c1d604fb94295955321f6bd45 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Wed, 20 Apr 2022 16:10:14 +0000
Subject: [PATCH] prevent warning and error when deleting consultation slots,
 fixes #932

Closes #932
---
 lib/models/ConsultationSlot.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/models/ConsultationSlot.php b/lib/models/ConsultationSlot.php
index ebda30a3815..a902f0631b5 100644
--- a/lib/models/ConsultationSlot.php
+++ b/lib/models/ConsultationSlot.php
@@ -46,7 +46,7 @@ class ConsultationSlot extends SimpleORMap
         };
         $config['registered_callbacks']['after_delete'][] = function ($slot) {
             $block = $slot->block;
-            if (count($block->slots) === 0) {
+            if ($block && count($block->slots) === 0) {
                 $block->delete();
             }
         };
-- 
GitLab