X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=query.cc;h=f5ee7aadc5ee7185037fce302c805ba1592c1f86;hp=c68bd37ad7fdb4bab5cc6f35cffcda8792b70919;hb=3b8e3ab666a54407f9596a53c66ba8ce623ac91d;hpb=9f673f3cf866d114edc77080cd9f9e266d403c14 diff --git a/query.cc b/query.cc index c68bd37a..f5ee7aad 100644 --- a/query.cc +++ b/query.cc @@ -165,12 +165,24 @@ notmuch_results_has_more (notmuch_results_t *results) notmuch_message_t * notmuch_results_get (notmuch_results_t *results) { + notmuch_message_t *message; Xapian::docid doc_id; + notmuch_private_status_t status; doc_id = *results->iterator; - return _notmuch_message_create (results, - results->notmuch, doc_id); + message = _notmuch_message_create (results, + results->notmuch, doc_id, + &status); + + if (message == NULL && + status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) + { + fprintf (stderr, "Internal error: a results iterator contains a non-existent document ID.\n"); + exit (1); + } + + return message; } void