summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/grep.c b/grep.c
index be99b34168..f3a27d7d6e 100644
--- a/grep.c
+++ b/grep.c
@@ -192,7 +192,8 @@ void compile_grep_patterns(struct grep_opt *opt)
* A classic recursive descent parser would do.
*/
p = opt->pattern_list;
- opt->pattern_expression = compile_pattern_expr(&p);
+ if (p)
+ opt->pattern_expression = compile_pattern_expr(&p);
if (p)
die("incomplete pattern expression: %s", p->pattern);
}