From 6544b4103671bad478455581463004475f18f98c Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Tue, 29 Oct 2024 16:05:46 +0000
Subject: [PATCH] prevent warning, fixes #4778

Closes #4778

Merge request studip/studip!3574
---
 lib/models/BlubberThread.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php
index 590a600e4a8..6753cfb8bed 100644
--- a/lib/models/BlubberThread.php
+++ b/lib/models/BlubberThread.php
@@ -428,11 +428,11 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
             return mb_substr($names, 0, 60);
         }
 
-        if($this['context_type'] === 'course') {
+        if ($this['context_type'] === 'course') {
             if ($this['content']) {
                 return mb_substr((string) Course::find($this['context_id'])->name . ': ' . $this['content'], 0, 50) . ' ...';
             } else {
-                return (string) Course::find($this['context_id'])->name;
+                return (string) (Course::find($this['context_id'])->name ?? _('unbekannt'));
             }
         }
 
-- 
GitLab