diff options
author | Keith Packard <keithp@keithp.com> | 2009-10-14 21:46:54 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-10-14 21:46:54 -0700 |
commit | a2c467242ac646bb16638906dec1bd075e098674 (patch) | |
tree | b8ca0eab888066d09c029b816872276973b5cee8 | |
parent | 8f3ccda00fc79cdd518277852496d88be4c7d4a9 (diff) |
Protect against missing message id while indexing files
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | notmuch-index-message.cc | 8 |
2 files changed, 6 insertions, 4 deletions
@@ -1,6 +1,6 @@ PROGS=notmuch-index-message xapian-dump -MYCXXFLAGS=-Wall +MYCXXFLAGS=-Wall -O0 -g all: $(PROGS) diff --git a/notmuch-index-message.cc b/notmuch-index-message.cc index 02f250b4..f16bd1ad 100644 --- a/notmuch-index-message.cc +++ b/notmuch-index-message.cc @@ -662,8 +662,10 @@ index_file (Xapian::WritableDatabase db, add_term (doc, "type", "mail"); add_term (doc, "source_id", "1"); - add_term (doc, "msgid", message_id); - doc.add_value (NOTMUCH_VALUE_MESSAGE_ID, message_id); + if (message_id) { + add_term (doc, "msgid", message_id); + doc.add_value (NOTMUCH_VALUE_MESSAGE_ID, message_id); + } if (thread_ids->len) { unsigned int i; @@ -687,7 +689,7 @@ index_file (Xapian::WritableDatabase db, doc.add_value (NOTMUCH_VALUE_THREAD, thread_id->str); g_string_free (thread_id, TRUE); - } else { + } else if (message_id) { /* If not referenced thread, use the message ID */ add_term (doc, "thread", message_id); doc.add_value (NOTMUCH_VALUE_THREAD, message_id); |