From db5b64317ed0b5f2b91b36553890e06d557c9fbe Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Mon, 7 Mar 2022 09:43:26 +0000 Subject: [PATCH] [FIX] mass_mailing: prevent traceback in _getCSSColorValue mass_mailing has an override of _getCSSColorValue which was basically never used since the option it's linked to was mostly inactive. Now it's active it became obvious there is a mistake in it that causes a traceback to occur when no color is passed to it. This adds the same check as in the original method and thereby prevents the traceback. task-2760157 closes odoo/odoo#84926 Signed-off-by: Thibault Delavallee (tde) --- addons/mass_mailing/static/src/js/mass_mailing_snippets.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_snippets.js b/addons/mass_mailing/static/src/js/mass_mailing_snippets.js index 0b6042fd247..f5f87c98158 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_snippets.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_snippets.js @@ -205,6 +205,9 @@ options.registry.ImageTools.include({ * @override */ _getCSSColorValue(color) { + if (!color || ColorpickerWidget.isCSSColor(color)) { + return color; + } const doc = this.options.document; if (doc && doc.querySelector('.o_mass_mailing_iframe') && !ColorpickerWidget.isCSSColor(color)) { const tempEl = doc.body.appendChild(doc.createElement('div'));