aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-search.c
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-11-18 03:29:30 -0800
committerGravatar Carl Worth <cworth@cworth.org>2009-11-18 03:29:30 -0800
commit306635c27d1ca46a51d354235f3e0c6ec4b65de6 (patch)
tree60919c958b7b8394b20c1704589aa1a87bfe8bbd /notmuch-search.c
parent26a4741b9cb75b55b0284cd16c91379aa6b96882 (diff)
notmuch search: Avoid infinite stream of exceptions from "notmuch search"
That is, give a nice error message and exit if no search terms are provided. Thanks to Priit Laes <plaes@plaes.org> for reporting the error and providing an early version of the fix.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r--notmuch-search.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/notmuch-search.c b/notmuch-search.c
index f7f9e70c..2b1c0fea 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -138,6 +138,10 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
fprintf (stderr, "Out of memory.\n");
return 1;
}
+ if (*query_str == '\0') {
+ fprintf (stderr, "Error: notmuch search requires at least one search term.\n");
+ return 1;
+ }
query = notmuch_query_create (notmuch, query_str);
if (query == NULL) {