From 145c88d43fce731c82e0b9c3067cc34eca3dd33a Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Mon, 17 Jan 2022 20:45:47 +0000 Subject: [PATCH] [ENTITY][Note] Only attempt to find mentions if we have content --- src/Entity/Note.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Entity/Note.php b/src/Entity/Note.php index 9527f60c90..a47f2fe68b 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -430,11 +430,14 @@ class Note extends Entity { $target_ids = $this->object_mentions_ids ?? []; if ($target_ids === []) { + $content = $this->getContent(); if (!\array_key_exists('object', $ids_already_known)) { - $mentions = Formatting::findMentions($this->getContent(), $this->getActor()); - foreach ($mentions as $mention) { - foreach ($mention['mentioned'] as $m) { - $target_ids[] = $m->getId(); + if (!\is_null($content)) { + $mentions = Formatting::findMentions($content, $this->getActor()); + foreach ($mentions as $mention) { + foreach ($mention['mentioned'] as $m) { + $target_ids[] = $m->getId(); + } } } } else {