Skip to content

Commit

Permalink
show_head_ref(): check the result of resolve_ref_namespace()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mhagger authored and gitster committed Apr 10, 2016
1 parent ded8393 commit 7fd12bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions http-backend.c
Expand Up @@ -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));
}
Expand Down

0 comments on commit 7fd12bf

Please sign in to comment.