Handle null pointer correctly
authorArt Cancro <ajc@citadel.org>
Tue, 27 Dec 2022 16:09:13 +0000 (11:09 -0500)
committerArt Cancro <ajc@citadel.org>
Tue, 27 Dec 2022 16:09:13 +0000 (11:09 -0500)
webcit-ng/static/js/view_mail.js

index 50e56eac4f03f8cf391d89e462b99972409a2b48..138be233ec67b490fafa0e420b7bc31888f46594 100644 (file)
@@ -270,9 +270,11 @@ function render_mailbox_display(notify) {
 
                        // If one or more messages was already selected, remember them so we can re-select them
                        if (displayed_message > 0) {
-                               for (i=0; row=oldtable.rows[i]; ++i) {
-                                       if (row.classList.contains("ctdl-mail-selected")) {
-                                               previously_selected.push(parseInt(row["id"].substring(12)));
+                               if (oldtable) {
+                                       for (i=0; row=oldtable.rows[i]; ++i) {
+                                               if (row.classList.contains("ctdl-mail-selected")) {
+                                                       previously_selected.push(parseInt(row["id"].substring(12)));
+                                               }
                                        }
                                }
                        }