X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessage.cc;h=38bc92914163bc92441ee05f8aede64a65d3efca;hp=7e825480ecc6e5782a93113e13b0e9730fac96fc;hb=f5db7ad7d243785c274a99734c681e69d13313d0;hpb=f42e2e43a0284491c02a55e45c2cf4233b2b94f1 diff --git a/lib/message.cc b/lib/message.cc index 7e825480..38bc9291 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -226,6 +226,10 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch, else if (*status_ret) return NULL; + /* If the message ID is too long, substitute its sha1 instead. */ + if (strlen (message_id) > NOTMUCH_MESSAGE_ID_MAX) + message_id = _notmuch_message_id_compressed (message, message_id); + term = talloc_asprintf (NULL, "%s%s", _find_prefix ("id"), message_id); if (term == NULL) { @@ -892,6 +896,9 @@ notmuch_message_get_date (notmuch_message_t *message) return 0; } + if (value.empty ()) + /* sortable_unserialise is undefined on empty string */ + return 0; return Xapian::sortable_unserialise (value); }