diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 79719a04287..50e6201634e 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -279,6 +279,13 @@ const UserValueWidget = Widget.extend({ * Closes the widget (only meaningful for widgets that can be closed). */ close: function () { + if (!this.el) { + // In case the method is called while the widget is not fully + // initialized yet. No need to prevent that case: asking a non + // initialized widget to close itself should just not be a problem + // and just be ignored. + return; + } this.trigger_up('user_value_widget_closing'); this.el.classList.remove('o_we_widget_opened'); this._userValueWidgets.forEach(widget => widget.close());