From d6ab44cc8f88bb1266baa3d72e2663641bd51096 Mon Sep 17 00:00:00 2001 From: Jim Nelson Date: Mon, 24 Oct 2011 16:27:37 -0700 Subject: [PATCH] Fixes crasher when email positions shift after FAST load: Closes #4279 --- src/engine/api/geary-email-location.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/api/geary-email-location.vala b/src/engine/api/geary-email-location.vala index 6c333ec4..ad8f7ab9 100644 --- a/src/engine/api/geary-email-location.vala +++ b/src/engine/api/geary-email-location.vala @@ -112,8 +112,14 @@ public class Geary.EmailLocation : Object { } private void on_folder_opened(Geary.Folder.OpenState state, int count) { - if (local_adjustment < 0 || count < local_adjustment) + // If no local_adjustment, nothing needs to be done; if the local_adjustment is greater or + // equal to the remote folder's count, that indicates messages have been removed, in which + // case let the adjustments occur via on_message_removed(). + if (local_adjustment < 0 || count <= local_adjustment) { + local_adjustment = -1; + return; + } int old_position = position; position = count - local_adjustment;