X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-reply.c;h=31e2c87cfe07651dec79d7c5fdc3286c0d865e61;hp=4a4a782b1636a269aa505f8b560f06eaa2cd337c;hb=394cb1c46d91a1bb28df9cc4a563e1115cc9af34;hpb=956917915f2cbeb43e04e9b98ad8301d0830c8c6 diff --git a/notmuch-reply.c b/notmuch-reply.c index 4a4a782b..31e2c87c 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -196,16 +196,21 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config)); - if (notmuch == NULL) - return 1; - query_string = query_string_from_args (ctx, argc, argv); if (query_string == NULL) { fprintf (stderr, "Out of memory\n"); return 1; } + if (*query_string == '\0') { + fprintf (stderr, "Error: notmuch reply requires at least one search term.\n"); + return 1; + } + + notmuch = notmuch_database_open (notmuch_config_get_database_path (config)); + if (notmuch == NULL) + return 1; + query = notmuch_query_create (notmuch, query_string); if (query == NULL) { fprintf (stderr, "Out of memory\n");