rev-list --bisect: Fix best == NULL case.
authorChristian Couder <chriscool@tuxfamily.org>
Thu, 20 Sep 2007 05:23:01 +0000 (07:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Sep 2007 07:10:48 +0000 (00:10 -0700)
Earlier commit ce0cbad77 broke rev-list --bisect to cause it
segfault when the resulting set is empty.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rev-list.c

index 899a31d09ac31aaf1336b5ab3959345ac83a9579..38946339999e4e136b898b8f314e27d22ec1decb 100644 (file)
@@ -436,10 +436,10 @@ static struct commit_list *find_bisection(struct commit_list *list,
        /* Do the real work of finding bisection commit. */
        best = do_find_bisection(list, nr, weights);
 
-       if (best)
+       if (best) {
                best->next = NULL;
-
-       *reaches = weight(best);
+               *reaches = weight(best);
+       }
        free(weights);
 
        return best;