]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-reply.c
Make reply/show/tag all require at least one search term
[notmuch] / notmuch-reply.c
index 4a4a782b1636a269aa505f8b560f06eaa2cd337c..31e2c87cfe07651dec79d7c5fdc3286c0d865e61 100644 (file)
@@ -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");