From 03d3f7924f938318979e6c135f68194e9f86394c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 27 Jul 2015 17:26:31 +0000 Subject: [PATCH] Make sure link_entry & file_upload are still present before trying to destroy them. Fixes hidden error when calling etemplate2.clear() with read-only link widgets. --- etemplate/js/et2_widget_link.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_widget_link.js b/etemplate/js/et2_widget_link.js index 3e81e77d59..b25bf5ce71 100644 --- a/etemplate/js/et2_widget_link.js +++ b/etemplate/js/et2_widget_link.js @@ -96,10 +96,16 @@ var et2_link_to = et2_inputWidget.extend( this.link_button = null; this.status_span = null; - this.link_entry.destroy(); - this.link_entry = null; - this.file_upload.destroy(); - this.file_upload = null; + if(this.link_entry) + { + this.link_entry.destroy(); + this.link_entry = null; + } + if(this.file_upload) + { + this.file_upload.destroy(); + this.file_upload = null; + } this.div = null; this._super.apply(this, arguments);