From 447645af2a689e8571f18f296c85f1f76a1290fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 23 Sep 2021 12:08:02 +0200 Subject: [PATCH] Prevent method calls on `null` in ConversationMessageAttachmentObjectType::canDownload() This may happen for attachments where the corresponding conversation / conversation message no longer exists. --- .../ConversationMessageAttachmentObjectType.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/lib/system/attachment/ConversationMessageAttachmentObjectType.class.php b/files/lib/system/attachment/ConversationMessageAttachmentObjectType.class.php index ce7e96d..621c1ed 100644 --- a/files/lib/system/attachment/ConversationMessageAttachmentObjectType.class.php +++ b/files/lib/system/attachment/ConversationMessageAttachmentObjectType.class.php @@ -55,7 +55,7 @@ class ConversationMessageAttachmentObjectType extends AbstractAttachmentObjectTy if ($objectID) { $message = new ConversationMessage($objectID); $conversation = Conversation::getUserConversation($message->conversationID, WCF::getUser()->userID); - if ($conversation->canRead()) { + if ($conversation !== null && $conversation->canRead()) { return true; } } -- 2.20.1