X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-show.c;h=96f287408fa12c2f729f3cc3f68a81fd533c46aa;hp=30b7df596854763f236a2c6fa9aeda7891bb9d7a;hb=1ddba66a3f4a7a118bc774d16cde00739144afcf;hpb=469d786c2548b0bcd711e79726c488094ffde583 diff --git a/notmuch-show.c b/notmuch-show.c index 30b7df59..96f28740 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -196,16 +196,21 @@ notmuch_show_command (void *ctx, unused (int argc), unused (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 show 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");