From 40b9776cfde1e8b416d77a71990b8b92c794ea22 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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/app/controllers/calendar/schedule.php b/app/controllers/calendar/schedule.php
index 6fb51c401e2..bd2b634d96f 100644
--- a/app/controllers/calendar/schedule.php
+++ b/app/controllers/calendar/schedule.php
@@ -243,12 +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 = [];
-                $entry_columns = array_pop($entry_columns);
-                if ($entry_columns) {
-                    $entries = $entry_columns->getEntries();
+                if (count($entry_columns) > 0) {
+                    $entries = array_pop($entry_columns)->getEntries();
+                    $this->show_entry = array_pop($entries);
+                } else {
+                    $this->show_entry = null;
                 }
-                $this->show_entry = array_pop($entries);
                 $this->render_template('calendar/schedule/_entry_schedule');
             }
         } else {
-- 
GitLab