From 2e4ae1f5fb4e014ab51cc683ba187662d3e51e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 12 Jul 2022 08:48:05 +0000 Subject: [PATCH] [FIX] mail: prevent crash when cancelling message edit task-2917199 closes odoo/odoo#95814 Signed-off-by: Louis Wicket (wil) --- addons/mail/static/src/models/composer_view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/models/composer_view.js b/addons/mail/static/src/models/composer_view.js index 9ca00a83f2f..2b03e04bd5b 100644 --- a/addons/mail/static/src/models/composer_view.js +++ b/addons/mail/static/src/models/composer_view.js @@ -50,6 +50,7 @@ registerModel({ discard() { if (this.messageViewInEditing) { this.messageViewInEditing.stopEditing(); + return; } if (this.threadView && this.threadView.replyingToMessageView) { const { threadView } = this; @@ -180,7 +181,9 @@ registerModel({ */ onClickCancelLink(ev) { ev.preventDefault(); - this.discard(); + if (this.exists()) { + this.discard(); + } }, /** * Discards the composer when clicking away.