[PATCH] git-rev-list: avoid crash on broken repository
authorSergey Vlasov <vsu@altlinux.ru>
Fri, 19 Aug 2005 18:28:35 +0000 (22:28 +0400)
committerJunio C Hamano <junkio@cox.net>
Fri, 19 Aug 2005 20:07:43 +0000 (13:07 -0700)
When following tags, check for parse_object() success and error out
properly instead of segfaulting.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
rev-list.c

index ce5b8b2..2ed5e87 100644 (file)
@@ -418,6 +418,8 @@ static struct commit *get_commit_reference(const char *name, unsigned int flags)
                if (tag_objects && !(object->flags & UNINTERESTING))
                        add_pending_object(object, tag->tag);
                object = parse_object(tag->tagged->sha1);
+               if (!object)
+                       die("bad object %s", sha1_to_hex(tag->tagged->sha1));
        }
 
        /*