X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=9c0952a495cf800bbb176e05013d098e1d72387a;hb=028c56061e820211f5757a49bf4da30198b29e29;hp=c76029067f4c28b32933e26e432713f39becd4b0;hpb=61993923b4b2e8c9871cc60681e91896c55e169c;p=notmuch diff --git a/lib/database.cc b/lib/database.cc index c7602906..9c0952a4 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -524,7 +524,7 @@ parse_references (void *ctx, GHashTable *hash, const char *refs) { - char *ref; + char *ref, *last_ref = NULL; if (refs == NULL || *refs == '\0') return NULL; @@ -532,20 +532,17 @@ parse_references (void *ctx, while (*refs) { ref = _parse_message_id (ctx, refs, &refs); - if (ref && strcmp (ref, message_id)) + if (ref && strcmp (ref, message_id)) { g_hash_table_insert (hash, ref, NULL); + last_ref = ref; + } } /* The return value of this function is used to add a parent * reference to the database. We should avoid making a message - * its own parent, thus the following check. + * its own parent, thus the above check. */ - - if (ref && strcmp(ref, message_id)) { - return ref; - } else { - return NULL; - } + return last_ref; } notmuch_status_t