@matheusbsbs / matheus-bagliano / commits / f73df331a4
Fork 0

peel_onion: handle NULL

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Koegler committed Feb 18, 2008 at 21:47 UTC f73df331a43a6092af427fd30bb6ce07f313743c
1 file changed +4 -1
sha1_name.c
+4 -1
@@ -494,8 +494,11 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
494 return error("%.*s: expected %s type, but the object dereferences to %s type",
495 len, name, typename(expected_type),
496 typename(o->type));
497 + if (!o)
498 + return -1;
499 if (!o->parsed)
498 - parse_object(o->sha1);
500 + if (!parse_object(o->sha1))
501 + return -1;
502 }
503 }
504 return 0;