summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-02-24 03:07:19 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-24 00:52:55 -0800
commit8c87dc77ae45d7277001b1be2c88ea9062e11d72 (patch)
tree0d17c0e219aaf5f7df8ab6f2eb84b60741674cbb /refs.c
parent6c0f86943e9ebba5aa281772e01559773e0c1234 (diff)
downloadgit-8c87dc77ae45d7277001b1be2c88ea9062e11d72.tar.gz
Protect peel_ref fallback case from NULL parse_object result
If the SHA-1 we are requesting the object for does not exist in the object database we get a NULL back. Accessing the type from that is not likely to succeed on any system. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 67d2a502af..fb33da1112 100644
--- a/refs.c
+++ b/refs.c
@@ -506,7 +506,7 @@ int peel_ref(const char *ref, unsigned char *sha1)
/* fallback - callers should not call this for unpacked refs */
o = parse_object(base);
- if (o->type == OBJ_TAG) {
+ if (o && o->type == OBJ_TAG) {
o = deref_tag(o, ref, 0);
if (o) {
hashcpy(sha1, o->sha1);