]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-for-each-ref.c
for-each-ref: cope with tags with incomplete lines
[thirdparty/git.git] / builtin-for-each-ref.c
index 445039e19c75e4c9321f7ee64289ef8201a25c14..4d25ec51d009bf18f95c60ca9ccd641ac5792db6 100644 (file)
@@ -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;