diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-20 12:29:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-20 13:29:30 -0700 |
commit | e276c26b4b65711c27e3ef37e732d41eeae42094 (patch) | |
tree | ccb0991f57fa881ed80e0c0093844d348b8825bd /builtin-for-each-ref.c | |
parent | diff --check: do not get confused by new blank lines in the middle (diff) | |
download | tgif-e276c26b4b65711c27e3ef37e732d41eeae42094.tar.xz |
for-each-ref: cope with tags with incomplete lines
If you have a tag with a single, incomplete line as its payload, asking
git-for-each-ref for its %(body) element accessed a NULL pointer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r-- | builtin-for-each-ref.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 445039e19c..4d25ec51d0 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con return; *sub = buf; /* first non-empty line */ buf = strchr(buf, '\n'); - if (!buf) + if (!buf) { + *body = ""; return; /* no body */ + } while (*buf == '\n') buf++; /* skip blank between subject and body */ *body = buf; |