From 93fa7eb0b5f022f9edae7e24dc680e7a364f65d1 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Sun, 12 Dec 2021 06:33:58 +0000 Subject: [PATCH] [ENTITY][Note] Language in notes is optional --- src/Entity/Note.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Entity/Note.php b/src/Entity/Note.php index e288a14bb1..81bcdad8a4 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -350,7 +350,12 @@ class Note extends Entity { $rendered = null; $mentions = []; - Event::handle('RenderNoteContent', [$this->getContent(), $this->getContentType(), &$rendered, $this->getActor(), Language::getById($this->getLanguageId())->getLocale(), &$mentions]); + Event::handle('RenderNoteContent', [$this->getContent(), + $this->getContentType(), + &$rendered, + $this->getActor(), + is_null($this->getLanguageId()) ? null : Language::getById($this->getLanguageId())->getLocale(), + &$mentions]); $mentioned = []; foreach ($mentions as $mention) { foreach ($mention['mentioned'] as $m) {