aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-04-07 15:03:09 -0400
committerJunio C Hamano <gitster@pobox.com>2016-04-10 11:35:39 -0700
commit7fd12bfbef015bb63f2376f678d71bca54bbc64d (patch)
treeead30367ecd200ef6dfb832fd29d936d6c472a65
parentded83936106a94f854873e949fa7928dce8dbdd1 (diff)
downloadgit-7fd12bfbef015bb63f2376f678d71bca54bbc64d.tar.gz
git-7fd12bfbef015bb63f2376f678d71bca54bbc64d.tar.xz
show_head_ref(): check the result of resolve_ref_namespace()
Only use the result of resolve_ref_namespace() if it is non-NULL. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--http-backend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/http-backend.c b/http-backend.c
index 8870a2681..214881459 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -484,9 +484,9 @@ static int show_head_ref(const char *refname, const struct object_id *oid,
const char *target = resolve_ref_unsafe(refname,
RESOLVE_REF_READING,
unused.hash, NULL);
- const char *target_nons = strip_namespace(target);
- strbuf_addf(buf, "ref: %s\n", target_nons);
+ if (target)
+ strbuf_addf(buf, "ref: %s\n", strip_namespace(target));
} else {
strbuf_addf(buf, "%s\n", oid_to_hex(oid));
}