From 9d72c61d4b768c3d99579e9ac84b3546427c6e2c Mon Sep 17 00:00:00 2001
From: Justus Dieckmann <justusdieckmann@wwu.de>
Date: Fri, 1 Mar 2024 15:42:50 +0100
Subject: [PATCH] Prevent error if there is no stream in the episode.json

---
 filter.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/filter.php b/filter.php
index 8c907ee..2bc93b0 100644
--- a/filter.php
+++ b/filter.php
@@ -134,7 +134,7 @@ class filter_opencast extends moodle_text_filter {
                                 $mustachedata->height = $height;
                                 $mustachedata->modplayerpath = (new moodle_url('/mod/opencast/player.html'))->out();
 
-                                if (count($data['streams']) === 1) {
+                                if (isset($data['streams']) && count($data['streams']) === 1) {
                                     $sources = $data['streams'][0]['sources'];
                                     $res = $sources[array_key_first($sources)][0]['res'];
                                     $resolution = $res['w'] . '/' . $res['h'];
-- 
GitLab