Skip to content

Commit 7fd12bf

Browse files
mhaggergitster
authored andcommitted
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>
1 parent ded8393 commit 7fd12bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

http-backend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,9 @@ static int show_head_ref(const char *refname, const struct object_id *oid,
484484
const char *target = resolve_ref_unsafe(refname,
485485
RESOLVE_REF_READING,
486486
unused.hash, NULL);
487-
const char *target_nons = strip_namespace(target);
488487

489-
strbuf_addf(buf, "ref: %s\n", target_nons);
488+
if (target)
489+
strbuf_addf(buf, "ref: %s\n", strip_namespace(target));
490490
} else {
491491
strbuf_addf(buf, "%s\n", oid_to_hex(oid));
492492
}

0 commit comments

Comments
 (0)