]> git.ipfire.org Git - thirdparty/git.git/blobdiff - grep.c
Merge branch 'rs/grep-parser-fix'
[thirdparty/git.git] / grep.c
diff --git a/grep.c b/grep.c
index 8f91af1cb006f95ee25668f0c080ec09c745c141..424a39591b05e519d166e064a9f4e3e6d5973681 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -657,6 +657,8 @@ static struct grep_expr *compile_pattern_and(struct grep_pat **list)
        x = compile_pattern_not(list);
        p = *list;
        if (p && p->token == GREP_AND) {
+               if (!x)
+                       die("--and not preceded by pattern expression");
                if (!p->next)
                        die("--and not followed by pattern expression");
                *list = p->next;