diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index b20e0645253..a01d7605851 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -257,8 +257,11 @@ } if (this.$active_snipped_id) { this.snippet_blur(this.$active_snipped_id); - this.$active_snipped_id.data("overlay").remove(); - this.$active_snipped_id.removeData("overlay"); + var $overlay = this.$active_snipped_id.data("overlay"); + if ($overlay) { + $overlay.remove(); + this.$active_snipped_id.removeData("overlay"); + } this.$active_snipped_id.removeData("snippet-editor"); this.$active_snipped_id = false; }