* [PATCH 1/6] Protect peel_ref fallback case from NULL parse_object result
@ 2008-02-24 8:07 Shawn O. Pearce
0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-02-24 8:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
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>
---
refs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 67d2a50..fb33da1 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);
--
1.5.4.3.295.g6b554
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-24 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 8:07 [PATCH 1/6] Protect peel_ref fallback case from NULL parse_object result Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).