]> git.notmuchmail.org Git - notmuch/blobdiff - lib/query.cc
notmuch search: Fix a second bug in the change to support incremental searches.
[notmuch] / lib / query.cc
index 1777e47dc044daa339c7ec0988e3d0fbef3de5a9..4b4c80f4d5f952d3340ce495c1c2583b984d76ca 100644 (file)
@@ -200,7 +200,7 @@ notmuch_query_search_threads (notmuch_query_t *query,
     seen = g_hash_table_new_full (g_str_hash, g_str_equal,
                                  free, NULL);
 
-    while (threads_seen < first + max_threads)
+    while (max_threads < 0 || threads_seen < first + max_threads)
     {
        int messages_seen_previously = messages_seen;
 
@@ -218,7 +218,7 @@ notmuch_query_search_threads (notmuch_query_t *query,
                                                thread_id, NULL,
                                                (void **) &thread))
            {
-               if (threads_seen > first) {
+               if (threads_seen >= first) {
                    thread = _notmuch_thread_create (query, query->notmuch,
                                                     thread_id);
                    g_ptr_array_add (threads->threads, thread);