From dad3f0607bf1c864f80723ab20b39527260f2c4f Mon Sep 17 00:00:00 2001 From: René Scharfe Date: Thu, 5 Sep 2019 21:55:55 +0200 Subject: tag: factor out get_tagged_oid() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a function for accessing the ID of the object referenced by a tag safely, i.e. without causing a segfault when encountering a broken tag where ->tagged is NULL. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- revision.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 07412297f0..ee1b1552b9 100644 --- a/revision.c +++ b/revision.c @@ -404,9 +404,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct tag *tag = (struct tag *) object; if (revs->tag_objects && !(flags & UNINTERESTING)) add_pending_object(revs, object, tag->tag); - if (!tag->tagged) - die("bad tag"); - object = parse_object(revs->repo, &tag->tagged->oid); + object = parse_object(revs->repo, get_tagged_oid(tag)); if (!object) { if (revs->ignore_missing_links || (flags & UNINTERESTING)) return NULL; -- cgit v1.3