X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-log.c;h=db71e0da745ee480f8705c81f2899daf1dc6c4f5;hb=bf474e2402e51843e8230c064da6ccfdf3a8ff54;hp=f4975cf35f7f1555739f7657ee62ed983d18cb84;hpb=04bb50f45dda9aeb755e943cbc9df264cfc8cbc5;p=git.git diff --git a/builtin-log.c b/builtin-log.c index f4975cf35..db71e0da7 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -356,7 +356,13 @@ int cmd_show(int argc, const char **argv, const char *prefix) t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); - objects[i].item = parse_object(t->tagged->sha1); + if (ret) + break; + o = parse_object(t->tagged->sha1); + if (!o) + ret = error("Could not read object %s", + sha1_to_hex(t->tagged->sha1)); + objects[i].item = o; i--; break; } @@ -461,7 +467,7 @@ static int extra_cc_alloc; static void add_header(const char *value) { int len = strlen(value); - while (value[len - 1] == '\n') + while (len && value[len - 1] == '\n') len--; if (!strncasecmp(value, "to: ", 4)) { ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc); @@ -835,7 +841,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) committer = git_committer_info(IDENT_ERROR_ON_NO_NAME); endpos = strchr(committer, '>'); if (!endpos) - die("bogos committer info %s\n", committer); + die("bogus committer info %s\n", committer); add_signoff = xmemdupz(committer, endpos - committer + 1); } else if (!strcmp(argv[i], "--attach")) {