peel_onion: handle NULL

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Martin Koegler 2008-02-18 21:47:58 +01:00 committed by Junio C Hamano
parent dec38c8165
commit f73df331a4

View File

@ -494,8 +494,11 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
return error("%.*s: expected %s type, but the object dereferences to %s type", return error("%.*s: expected %s type, but the object dereferences to %s type",
len, name, typename(expected_type), len, name, typename(expected_type),
typename(o->type)); typename(o->type));
if (!o)
return -1;
if (!o->parsed) if (!o->parsed)
parse_object(o->sha1); if (!parse_object(o->sha1))
return -1;
} }
} }
return 0; return 0;