mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
Fix notmuch_message_get_message_id to never return NULL.
With the recent improvements to the handling of message IDs we "know" that a NULL message ID is impossible, (so we simply abort if the impossible happens).
This commit is contained in:
parent
6ccdffcd87
commit
ce5d782962
2 changed files with 9 additions and 4 deletions
|
@ -215,10 +215,11 @@ notmuch_message_get_message_id (notmuch_message_t *message)
|
||||||
i = message->doc.termlist_begin ();
|
i = message->doc.termlist_begin ();
|
||||||
i.skip_to (_find_prefix ("msgid"));
|
i.skip_to (_find_prefix ("msgid"));
|
||||||
|
|
||||||
/* XXX: This should really be an internal error, but we'll need to
|
if (i == message->doc.termlist_end ()) {
|
||||||
* fix the add_message side of things first. */
|
fprintf (stderr, "Internal error: Message with document ID of %d has no message ID.\n",
|
||||||
if (i == message->doc.termlist_end ())
|
message->doc_id);
|
||||||
return NULL;
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
message->message_id = talloc_strdup (message, (*i).c_str () + 1);
|
message->message_id = talloc_strdup (message, (*i).c_str () + 1);
|
||||||
return message->message_id;
|
return message->message_id;
|
||||||
|
|
|
@ -338,6 +338,10 @@ notmuch_results_destroy (notmuch_results_t *results);
|
||||||
* modified by the caller and will only be valid for as long as the
|
* modified by the caller and will only be valid for as long as the
|
||||||
* message is valid, (which is until the query from which it derived
|
* message is valid, (which is until the query from which it derived
|
||||||
* is destroyed).
|
* is destroyed).
|
||||||
|
*
|
||||||
|
* This function will not return NULL since Notmuch ensures that every
|
||||||
|
* message has a unique message ID, (Notmuch will generate an ID for a
|
||||||
|
* message if the original file does not contain one).
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
notmuch_message_get_message_id (notmuch_message_t *message);
|
notmuch_message_get_message_id (notmuch_message_t *message);
|
||||||
|
|
Loading…
Reference in a new issue