diff options
author | René Scharfe <l.s.r@web.de> | 2019-09-05 22:59:42 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-09-06 00:11:34 +0300 |
commit | c77722b3ea42a87381915f1203648a5f5d86c1ff (patch) | |
tree | 44b3e742d69e5e3334b5865ae1237cc9c045f258 /ref-filter.c | |
parent | dad3f0607bf1c864f80723ab20b39527260f2c4f (diff) |
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 'ref-filter.c')
-rw-r--r-- | ref-filter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ref-filter.c b/ref-filter.c index f27cfc8c3e..8dcc17c049 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1766,7 +1766,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err) * If it is a tag object, see if we use a value that derefs * the object, and if we do grab the object it refers to. */ - oi_deref.oid = ((struct tag *)obj)->tagged->oid; + oi_deref.oid = *get_tagged_oid((struct tag *)obj); /* * NEEDSWORK: This derefs tag only once, which @@ -1997,7 +1997,7 @@ static const struct object_id *match_points_at(struct oid_array *points_at, if (!obj) die(_("malformed object at '%s'"), refname); if (obj->type == OBJ_TAG) - tagged_oid = &((struct tag *)obj)->tagged->oid; + tagged_oid = get_tagged_oid((struct tag *)obj); if (tagged_oid && oid_array_lookup(points_at, tagged_oid) >= 0) return tagged_oid; return NULL; |