{"thread":{"id":"12282","subject":"[PATCH 1/6] Protect peel_ref fallback case from NULL parse_object result","startedAt":"2008-02-24T08:07:19Z","lastAt":"2008-02-24T08:07:19Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"69762","messageId":"20080224080719.GA22587@spearce.org","threadId":"12282","inReplyTo":null,"subject":"[PATCH 1/6] Protect peel_ref fallback case from NULL parse_object result","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-24T08:07:19Z","receivedAt":"2008-02-24T08:07:19Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the SHA-1 we are requesting the object for does not exist in\nthe object database we get a NULL back.  Accessing the type from\nthat is not likely to succeed on any system.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n refs.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex 67d2a50..fb33da1 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -506,7 +506,7 @@ int peel_ref(const char *ref, unsigned char *sha1)\n \n \t/* fallback - callers should not call this for unpacked refs */\n \to = parse_object(base);\n-\tif (o->type == OBJ_TAG) {\n+\tif (o && o->type == OBJ_TAG) {\n \t\to = deref_tag(o, ref, 0);\n \t\tif (o) {\n \t\t\thashcpy(sha1, o->sha1);\n-- \n1.5.4.3.295.g6b554\n"}]}