From f60293a635cd358bc559ef248a9e0936084a08c9 Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Fri, 18 Mar 2022 08:51:57 +0000
Subject: [PATCH] fix #803

---
 lib/models/Courseware/BlockTypes/Text.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/models/Courseware/BlockTypes/Text.php b/lib/models/Courseware/BlockTypes/Text.php
index c4fe67c68db..7edeebc9262 100755
--- a/lib/models/Courseware/BlockTypes/Text.php
+++ b/lib/models/Courseware/BlockTypes/Text.php
@@ -100,7 +100,9 @@ class Text extends BlockType
                 $file = $this->extractFile($element->getAttribute('src'));
                 if ($file !== null) {
                     $file_copy_id = $this->copyFileById($file->id, $rangeId);
-                    $element->setAttribute('src', \FileRef::find($file_copy_id)->getDownloadURL());
+                    if ($file_copy_id) {
+                        $element->setAttribute('src', \FileRef::find($file_copy_id)->getDownloadURL());
+                    }
                 }
             }
             $payload['text'] = $document->saveHTML();
-- 
GitLab