Gracefully handle deleted messages in MessageAttachmentObjectType

This commit is contained in:
Tim Düsterhus 2023-02-22 17:31:20 +01:00
parent 4579696576
commit ac4178bd36
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
2 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,7 @@ Additional Use Grant: You may use the Licensed Work when your application
uses the Licensed Work for a purpose that does neither
directly or indirectly generate revenue.
Change Date: 2027-02-02
Change Date: 2027-02-22
Change License: Version 2 or later of the GNU General Public License as
published by the Free Software Foundation.

View File

@ -1,12 +1,12 @@
<?php
/*
* Copyright (c) 2010-2022 Tim Düsterhus.
* Copyright (c) 2010-2023 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2026-09-17
* Change Date: 2027-02-22
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
@ -35,6 +35,10 @@ final class MessageAttachmentObjectType extends AbstractAttachmentObjectType
if ($objectID) {
$message = new Message($objectID);
if (!$message->messageID) {
return false;
}
\assert($message->getMessageType()->objectType === 'be.bastelstu.chat.messageType.attachment');
$room = $message->getRoom();