&message);
if (status == NOTMUCH_STATUS_SUCCESS && message) {
- status = _notmuch_message_remove_filename (message, filename);
+ if (notmuch_message_count_files (message) > 1) {
+ status = _notmuch_message_remove_filename (message, filename);
+ }
if (status == NOTMUCH_STATUS_SUCCESS)
status = _notmuch_message_delete (message);
else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)