From 95e1fb860af256929f4ef9f3a26d20ee167c19a3 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 18 Jul 2014 17:22:28 +0000 Subject: [PATCH] Make sure et2 is availabe, because it could be not available over cases like when mail connection error. It Fixes error: "can not read getWidgetById of undefined" --- mail/js/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index edec6379ac..ea1d711f79 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -227,7 +227,7 @@ app.classes.mail = AppJS.extend( break; case 'emailadmin': // update tree with given mail account _id and _type - var tree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); + var tree = this.et2 ? this.et2.getWidgetById(this.nm_index+'[foldertree]') : null; if (!tree) break; var node = tree.getNode(_id); switch(_type) @@ -1209,7 +1209,8 @@ app.classes.mail = AppJS.extend( * Object with the required data (KEY id, VALUE desc), or ID => {new data} */ mail_reloadNode: function(_status) { - var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); + var ftree = this.et2?this.et2.getWidgetById(this.nm_index+'[foldertree]'):null; + if (!ftree) return; var selectedNode = ftree.getSelectedNode(); for (var i in _status) {