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 157c8a5728c4ad8fdd542fe2a767b7d17c6d47e1
Author: Daniel Gruno <[email protected]>
AuthorDate: Sat Nov 13 17:33:27 2021 +0100

    lint and more guarding
---
 webui/js/ponymail.js               | 8 ++++++--
 webui/js/source/listview-header.js | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index f4c68e0..5fabacc 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -2169,7 +2169,7 @@ function listview_header(state, json) {
     if (current_list == 'virtual' && current_domain == 'inbox') {
         list_title = "Virtual inbox, past 30 days";
     }
-    let blobs = json.emails;
+    let blobs = json.emails || [];
     if (current_listmode == 'threaded') blobs = json.thread_struct;
 
     if (current_year && current_month) {
@@ -2178,7 +2178,11 @@ function listview_header(state, json) {
         list_title += ", past month";
     }
 
-    if (json.searchParams && json.searchParams.q && json.searchParams.q.length 
|| (json.searchParams.d || "").match(/=/)) {
+    if (json.searchParams && (
+            json.searchParams.q &&
+            json.searchParams.q.length ||
+            (json.searchParams.d || "").match(/=/))
+    ){
         list_title = "Custom search";
     }
     document.title = list_title + " - " + prefs.title;
diff --git a/webui/js/source/listview-header.js 
b/webui/js/source/listview-header.js
index 60861ec..0b48263 100644
--- a/webui/js/source/listview-header.js
+++ b/webui/js/source/listview-header.js
@@ -26,7 +26,7 @@ function listview_header(state, json) {
     if (current_list == 'virtual' && current_domain == 'inbox') {
         list_title = "Virtual inbox, past 30 days";
     }
-    let blobs = json.emails;
+    let blobs = json.emails || [];
     if (current_listmode == 'threaded') blobs = json.thread_struct;
 
     if (current_year && current_month) {
@@ -35,7 +35,11 @@ function listview_header(state, json) {
         list_title += ", past month";
     }
 
-    if (json.searchParams && json.searchParams.q && json.searchParams.q.length 
|| (json.searchParams.d || "").match(/=/)) {
+    if (json.searchParams && (
+            json.searchParams.q &&
+            json.searchParams.q.length ||
+            (json.searchParams.d || "").match(/=/))
+    ){
         list_title = "Custom search";
     }
     document.title = list_title + " - " + prefs.title;

Reply via email to