const char *from, *to, *subject, *old_filename;
char *message_id;
+ if (message_ret)
+ *message_ret = NULL;
+
message_file = notmuch_message_file_open (filename);
if (message_file == NULL) {
ret = NOTMUCH_STATUS_FILE_ERROR;
DONE:
if (message) {
- if (message_ret)
+ if (ret == NOTMUCH_STATUS_SUCCESS && message_ret)
*message_ret = message;
else
notmuch_message_destroy (message);
* reference the filename, and will not copy the entire contents of
* the file.
*
- * If 'message' is not NULL, then '*message' will be initialized to a
- * message object that can be used for things such as adding tags to
- * the just-added message. The user should call
- * notmuch_message_destroy when done with the message.
+ * If 'message' is not NULL, then, on successful return '*message'
+ * will be initialized to a message object that can be used for things
+ * such as adding tags to the just-added message. The user should call
+ * notmuch_message_destroy when done with the message. On any failure
+ * '*message' will be set to NULL.
*
* Return value:
*