From ae363b74ad8b295f984ba540fdcb5f0918faa5ea Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 12 Nov 2020 16:52:55 +0000 Subject: [PATCH] Check for empty body to prevent a fatal error --- src/Model/Item.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 834a1c218d..d5f57cff75 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2479,12 +2479,15 @@ class Item */ private static function getLanguage(array $item) { - if (!in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT])) { + if (!in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT]) || empty($item['body'])) { return ''; } // Convert attachments to links $naked_body = BBCode::removeAttachment($item['body']); + if (empty($naked_body)) { + return ''; + } // Remove links and pictures $naked_body = BBCode::removeLinks($naked_body);