From 9fb1d55009f0c9c7c84398eb3a152e5398acc7ca Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Thu, 1 Feb 2024 12:07:42 +0000
Subject: [PATCH] fixes #3186

Closes #3186

Merge request studip/studip!2572
---
 app/controllers/calendar/schedule.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/controllers/calendar/schedule.php b/app/controllers/calendar/schedule.php
index bdd0f51c2b4..88c4304ab48 100644
--- a/app/controllers/calendar/schedule.php
+++ b/app/controllers/calendar/schedule.php
@@ -243,8 +243,12 @@ class Calendar_ScheduleController extends AuthenticatedController
                 $this->render_template('calendar/schedule/_entry_course');
             } else if ($id) {
                 $entry_columns = CalendarScheduleModel::getScheduleEntries($GLOBALS['user']->id, 0, 0, $id);
-                $entries = array_pop($entry_columns)->getEntries();
-                $this->show_entry = array_pop($entries);
+                if (count($entry_columns) > 0) {
+                    $entries = array_pop($entry_columns)->getEntries();
+                    $this->show_entry = array_pop($entries);
+                } else {
+                    $this->show_entry = null;
+                }
                 $this->render_template('calendar/schedule/_entry_schedule');
             }
         } else {
-- 
GitLab