From f4ea4a282a6f2c634c8ab6f6b676dd53c75cf2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bellegarde?= Date: Mon, 20 Mar 2023 07:05:48 +0100 Subject: [PATCH] client: Fix next conversation selection on mail merge When conversation monitor is merging emails, we need to calculate next selected conversation. This may happen even if no conversation is currently selected resulting on second conversation being selected. Only return a valid conversation if current selection is not empty. --- src/client/conversation-list/conversation-list-view.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/conversation-list/conversation-list-view.vala b/src/client/conversation-list/conversation-list-view.vala index 0489ad3f..0a082563 100644 --- a/src/client/conversation-list/conversation-list-view.vala +++ b/src/client/conversation-list/conversation-list-view.vala @@ -512,8 +512,14 @@ public class ConversationList.View : Gtk.ScrolledWindow, Geary.BaseInterface { */ private Gtk.ListBoxRow? get_next_conversation(bool asc=true) { int index = asc ? 0 : int.MAX; + GLib.List selected_rows; - foreach (Gtk.ListBoxRow row in this.list.get_selected_rows().copy()) { + selected_rows = this.list.get_selected_rows(); + if (selected_rows.length() == 0 ) { + return null; + } + + foreach (var row in selected_rows) { if ((asc && row.get_index() > index) || (!asc && row.get_index() < index)) { index = row.get_index();