{"thread":{"id":"54391","subject":"[PATCH] blame: handle deref_tag() returning NULL","startedAt":"2020-10-11T16:04:00Z","lastAt":"2020-10-11T16:04:00Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"407305","messageId":"3cf2bcfb-521d-0f4f-a8cb-8d6507c69f35@web.de","threadId":"54391","inReplyTo":null,"subject":"[PATCH] blame: handle deref_tag() returning NULL","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-10-11T16:03:37Z","receivedAt":"2020-10-11T16:04:00Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Signed-off-by: René Scharfe <l.s.r@web.de>\n---\n blame.c         | 6 +++---\n builtin/blame.c | 2 ++\n 2 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex 686845b2b4..de7b5d411f 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -2670,7 +2670,7 @@ static struct commit *find_single_final(struct rev_info *revs,\n \t\tif (obj->flags & UNINTERESTING)\n \t\t\tcontinue;\n \t\tobj = deref_tag(revs->repo, obj, NULL, 0);\n-\t\tif (obj->type != OBJ_COMMIT)\n+\t\tif (!obj || obj->type != OBJ_COMMIT)\n \t\t\tdie(\"Non commit %s?\", revs->pending.objects[i].name);\n \t\tif (found)\n \t\t\tdie(\"More than one commit to dig from %s and %s?\",\n@@ -2701,7 +2701,7 @@ static struct commit *dwim_reverse_initial(struct rev_info *revs,\n \t/* Is that sole rev a committish? */\n \tobj = revs->pending.objects[0].item;\n \tobj = deref_tag(revs->repo, obj, NULL, 0);\n-\tif (obj->type != OBJ_COMMIT)\n+\tif (!obj || obj->type != OBJ_COMMIT)\n \t\treturn NULL;\n\n \t/* Do we have HEAD? */\n@@ -2737,7 +2737,7 @@ static struct commit *find_single_initial(struct rev_info *revs,\n \t\tif (!(obj->flags & UNINTERESTING))\n \t\t\tcontinue;\n \t\tobj = deref_tag(revs->repo, obj, NULL, 0);\n-\t\tif (obj->type != OBJ_COMMIT)\n+\t\tif (!obj || obj->type != OBJ_COMMIT)\n \t\t\tdie(\"Non commit %s?\", revs->pending.objects[i].name);\n \t\tif (found)\n \t\t\tdie(\"More than one commit to dig up from, %s and %s?\",\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex bb0f29300e..b5036ab327 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -820,6 +820,8 @@ static int peel_to_commit_oid(struct object_id *oid_ret, void *cbdata)\n \t\tif (kind != OBJ_TAG)\n \t\t\treturn -1;\n \t\tobj = deref_tag(r, parse_object(r, &oid), NULL, 0);\n+\t\tif (!obj)\n+\t\t\treturn -1;\n \t\toidcpy(&oid, &obj->oid);\n \t}\n }\n--\n2.28.0\n"}]}