X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fdatabase.cc;h=58a350d2f59e8368006d681a2508d20453b2254b;hp=ce9a86bfddb8b525a19ecefe27d443bb803a8d01;hb=656e4c413d84984dcc5fbd8016907ed03c343cb8;hpb=fc3a3be33716675a4169ab4265a28250764b283d diff --git a/lib/database.cc b/lib/database.cc index ce9a86bf..58a350d2 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -185,7 +185,7 @@ notmuch_status_to_string (notmuch_status_t status) case NOTMUCH_STATUS_TAG_TOO_LONG: return "Tag value is too long (exceeds NOTMUCH_TAG_MAX)"; case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: - return "Unblanced number of calls to notmuch_message_freeze/thaw"; + return "Unbalanced number of calls to notmuch_message_freeze/thaw"; default: case NOTMUCH_STATUS_LAST_STATUS: return "Unknown error status value"; @@ -908,7 +908,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, * is to find a message ID (or else create one ourselves). */ header = notmuch_message_file_get_header (message_file, "message-id"); - if (header) { + if (header && *header != '\0') { message_id = _parse_message_id (message_file, header, NULL); /* So the header value isn't RFC-compliant, but it's * better than no message-id at all. */ @@ -940,8 +940,11 @@ notmuch_database_add_message (notmuch_database_t *notmuch, talloc_free (message_id); - if (message == NULL) + if (message == NULL) { + ret = COERCE_STATUS (private_status, + "Unexpected status value from _notmuch_message_create_for_message_id"); goto DONE; + } /* Is this a newly created message object? */ if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {