git log: avoid segfault with --all-match
authorMichele Ballabio <barra_cuda@katamail.com>
Wed, 18 Mar 2009 20:53:27 +0000 (21:53 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Mar 2009 02:10:40 +0000 (19:10 -0700)
Avoid a segfault when the command

git log --all-match

was issued, by ignoring the option.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c

diff --git a/grep.c b/grep.c
index be99b3416867ff68a1c2c1a3646be35baf61f8b2..f3a27d7d6e141bd8813b978edbe33d16aa764fb4 100644 (file)
--- 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);
 }