From 9818f1c535217a2b70cb6f248dcc93fd7055e331 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 2 Nov 2017 16:18:47 +0100 Subject: [PATCH] [FIX] web_editor: allow selecting an uploaded img without crash Somehow, fixing multi selection with https://github.com/odoo/odoo/commit/e011d58bee140411ccfb1ef9115dddc090d573c3 broke the use of the image upload button combined with no selected image at the beginning. --- addons/web_editor/static/src/js/widgets/widgets.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index 1c2f542c6cd..f8626e33390 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -621,6 +621,9 @@ var fontIconsDialog = Widget.extend({ ]; }, clear: function () { + if (!this.media) { + return; + } this.media.className = this.media.className.replace(/(^|\s)(fa(\s|$)|fa-[^\s]*)/g, ' '); }, }); @@ -700,6 +703,9 @@ var VideoDialog = Widget.extend({ * @override */ clear: function () { + if (!this.media) { + return; + } if (this.media.dataset.src) { try { delete this.media.dataset.src;