[geary/mjog/invert-folder-class-hierarchy: 56/72] ConversationListStore: Fix null object when no previews are available




commit 8820a9b9f1fa1f091741065b3dfc6f6748a6b20c
Author: Michael Gratton <mike vee net>
Date:   Sun Feb 21 17:04:29 2021 +1100

    ConversationListStore: Fix null object when no previews are available

 .../conversation-list/conversation-list-store.vala     | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-store.vala 
b/src/client/conversation-list/conversation-list-store.vala
index fc8d0cdef..b30140586 100644
--- a/src/client/conversation-list/conversation-list-store.vala
+++ b/src/client/conversation-list/conversation-list-store.vala
@@ -182,14 +182,16 @@ public class ConversationListStore : Gtk.ListStore {
         if (conversation_monitor == null || !this.config.display_preview)
             return;
 
-        Gee.Set<Geary.EmailIdentifier> needing_previews = get_emails_needing_previews();
-
-        Gee.ArrayList<Geary.Email> emails = new Gee.ArrayList<Geary.Email>();
-        if (needing_previews.size > 0)
-            emails.add_all(yield do_get_previews_async(needing_previews));
-        if (emails.size < 1)
-            return;
-
+        Gee.Set<Geary.EmailIdentifier> needing_previews =
+            get_emails_needing_previews();
+
+        var emails = new Gee.ArrayList<Geary.Email>();
+        if (needing_previews.size > 0) {
+            var with_previews = yield do_get_previews_async(needing_previews);
+            if (with_previews != null) {
+                emails.add_all(with_previews);
+            }
+        }
         foreach (Geary.Email email in emails) {
             Geary.App.Conversation? conversation = conversation_monitor.get_by_email_identifier(email.id);
             // The conversation can be null if e.g. a search is


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]