From f266f5ff365391f1127056d49c52b5022879dfe8 Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Thu, 20 Nov 2025 08:06:00 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B08911=20-=20Attachment=20visualisation=20?= =?UTF-8?q?broken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Hook/EventListener.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/datamodels/2.x/itop-attachments/src/Hook/EventListener.php b/datamodels/2.x/itop-attachments/src/Hook/EventListener.php index 47723b063..53949b7b1 100644 --- a/datamodels/2.x/itop-attachments/src/Hook/EventListener.php +++ b/datamodels/2.x/itop-attachments/src/Hook/EventListener.php @@ -67,15 +67,17 @@ class EventListener implements iEventServiceSetup /** @var \DBObject $oAttachment */ $oAttachment = $oEventData->Get('object'); $oHostObj = MetaModel::GetObject($oAttachment->Get('item_class'), $oAttachment->Get('item_id'), false /* false to avoid exception during trigger */, true); - /** @var \ormDocument $oDocument */ - $oDocument = $oEventData->Get('document'); + if ($oHostObj != null) { + /** @var \ormDocument $oDocument */ + $oDocument = $oEventData->Get('document'); - $this->OnAttachmentActivateTriggers( - $oHostObj, - $oAttachment, - $oDocument, - TriggerOnAttachmentDownload::class - ); + $this->OnAttachmentActivateTriggers( + $oHostObj, + $oAttachment, + $oDocument, + TriggerOnAttachmentDownload::class + ); + } } /**