summaryrefslogtreecommitdiff
path: root/message.cc
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-23 06:04:57 -0700
committerCarl Worth <cworth@cworth.org>2009-10-23 06:04:57 -0700
commitce5d78296251b529838df0dbd4dc3b9a90030924 (patch)
tree241c4497dd9a32bcfd6d9fae4ecaf0d4a455c7af /message.cc
parent6ccdffcd87b8af0c1c683588612169f5dc776644 (diff)
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).
Diffstat (limited to 'message.cc')
-rw-r--r--message.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/message.cc b/message.cc
index ce600af..65e5ad7 100644
--- a/message.cc
+++ b/message.cc
@@ -215,10 +215,11 @@ notmuch_message_get_message_id (notmuch_message_t *message)
i = message->doc.termlist_begin ();
i.skip_to (_find_prefix ("msgid"));
- /* XXX: This should really be an internal error, but we'll need to
- * fix the add_message side of things first. */
- if (i == message->doc.termlist_end ())
- return NULL;
+ if (i == message->doc.termlist_end ()) {
+ fprintf (stderr, "Internal error: Message with document ID of %d has no message ID.\n",
+ message->doc_id);
+ exit (1);
+ }
message->message_id = talloc_strdup (message, (*i).c_str () + 1);
return message->message_id;