[geary/mjog/misc-criticals: 1/9] ConversationListView: Fix critical updating selection without a model



commit 164c34e32ae001e1e4aca9089fcea77f75af146a
Author: Michael Gratton <mike vee net>
Date:   Thu Jun 25 15:52:55 2020 +1000

    ConversationListView: Fix critical updating selection without a model
    
    Fixes #802

 src/client/conversation-list/conversation-list-view.vala | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 158708cac..89db534e2 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -541,12 +541,15 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
     public void select_conversations(Gee.Collection<Geary.App.Conversation> new_selection) {
         if (this.selected.size != new_selection.size ||
             !this.selected.contains_all(new_selection)) {
-            Gtk.TreeSelection selection = get_selection();
+            var selection = get_selection();
             selection.unselect_all();
-            foreach (var conversation in new_selection) {
-                Gtk.TreePath path = get_model().get_path_for_conversation(conversation);
-                if (path != null) {
-                    selection.select_path(path);
+            var model = get_model();
+            if (model != null) {
+                foreach (var conversation in new_selection) {
+                    var path = model.get_path_for_conversation(conversation);
+                    if (path != null) {
+                        selection.select_path(path);
+                    }
                 }
             }
         }


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