summaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2019-09-05 21:59:42 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-09-05 14:11:34 -0700
commitc77722b3ea42a87381915f1203648a5f5d86c1ff (patch)
tree44b3e742d69e5e3334b5865ae1237cc9c045f258 /builtin/describe.c
parenttag: factor out get_tagged_oid() (diff)
downloadtgif-c77722b3ea42a87381915f1203648a5f5d86c1ff.tar.xz
use get_tagged_oid()
Avoid derefencing ->tagged without checking for NULL by using the convenience wrapper for getting the ID of the tagged object. It die()s when encountering a broken tag instead of segfaulting. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
-rw-r--r--builtin/describe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 200154297d..e048f85484 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -313,7 +313,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
*/
append_name(n, dst);
if (longformat)
- append_suffix(0, n->tag ? &n->tag->tagged->oid : oid, dst);
+ append_suffix(0, n->tag ? get_tagged_oid(n->tag) : oid, dst);
if (suffix)
strbuf_addstr(dst, suffix);
return;