This is an automated email from the ASF dual-hosted git repository. humbedooh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 82a522d5de8ffbbc184e05b4c169dbc53f192374 Author: Daniel Gruno <[email protected]> AuthorDate: Fri Dec 10 20:30:09 2021 +0100 only append if it exists --- webui/js/source/listview-treeview.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/webui/js/source/listview-treeview.js b/webui/js/source/listview-treeview.js index 7677e97..8305104 100644 --- a/webui/js/source/listview-treeview.js +++ b/webui/js/source/listview-treeview.js @@ -16,7 +16,8 @@ */ function find_email(json, id) { - for (let eml of json.emails) { + if (!json) return + for (let eml of json.emails || []) { if (id === eml.id) return eml } } @@ -27,8 +28,12 @@ function listview_treeview(json, start) { let s = start || 0; let email_ordered = []; for (let thread of json.thread_struct) { - email_ordered.push(find_email(json, thread.tid)); - for (let child of thread.children) email_ordered.push(find_email(json, child.tid)); + let eml = find_email(json, thread.tid); + if (eml) email_ordered.push(eml); + for (let child of thread.children) { + let eml = find_email(json, child.tid); + if (eml) email_ordered.push(eml); + } } if (email_ordered.length) { for (let n = s; n < (s + G_current_per_page); n++) {
