From cdb469bce540ee549d732338f0e15706cd54b5bf Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Wed, 16 Dec 2020 10:35:51 +0000 Subject: [PATCH] [FIX] mail: prevents traceback when clicking attachment unlink button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, quickly clicking on the unlink button of an attachment could result in a traceback if the click happened right after the deletion of attachment but before the rendering of the DOM. part of task-2363522 closes odoo/odoo#63447 X-original-commit: 1858184394342f24f5456728c4255f9980220c20 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/components/attachment/attachment.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/static/src/components/attachment/attachment.js b/addons/mail/static/src/components/attachment/attachment.js index 6dc894027d9..f62113c4c41 100644 --- a/addons/mail/static/src/components/attachment/attachment.js +++ b/addons/mail/static/src/components/attachment/attachment.js @@ -131,6 +131,9 @@ class Attachment extends Component { */ _onClickUnlink(ev) { ev.stopPropagation(); + if (!this.attachment) { + return; + } if (this.attachment.isLinkedToComposer) { this.attachment.remove(); this.trigger('o-attachment-removed', { attachmentLocalId: this.props.attachmentLocalId });