From: Tim Düsterhus Date: Thu, 23 Sep 2021 10:08:02 +0000 (+0200) Subject: Prevent method calls on `null` in ConversationMessageAttachmentObjectType::canDownload() X-Git-Tag: 5.4.8_dev_2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=447645af2a689e8571f18f296c85f1f76a1290fa;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Prevent method calls on `null` in ConversationMessageAttachmentObjectType::canDownload() This may happen for attachments where the corresponding conversation / conversation message no longer exists. --- 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; } }