diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 0a45d4682d..30a92eb938 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -883,7 +883,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) res = value return res } - else if(_id.startsWith(value.id) && typeof value.item !== "undefined") + else if(_id?.startsWith(value.id) && typeof value.item !== "undefined") { res = this._search(_id, value.item) } diff --git a/mail/js/app.js b/mail/js/app.js index 56842e0986..a8b6c926f0 100755 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1890,8 +1890,8 @@ app.classes.mail = AppJS.extend( archivefolder_enabled: function(_action,_senders,_currentNode) { var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); - var acc_id = _senders[0].id.split('::')[2]; // this is operating on mails - var node = ftree ? ftree.getNode(acc_id) : null; + var acc_id = _currentNode.id.split('::')[2]; // this is operating on mails + var node = ftree && acc_id ? ftree.getNode(acc_id) : null; return node && node.data && node.data.archivefolder; },