submodule--helper: don't print null in 'submodule status'
[gitweb.git] / builtin / submodule--helper.c
index a4193c01d96629c66c62232e80d3d6be151aaab6..d85b29b49e48ea83d2fb37ff070db27a9920200b 100644 (file)
@@ -562,8 +562,12 @@ static void print_status(unsigned int flags, char state, const char *path,
 
        printf("%c%s %s", state, oid_to_hex(oid), displaypath);
 
-       if (state == ' ' || state == '+')
-               printf(" (%s)", compute_rev_name(path, oid_to_hex(oid)));
+       if (state == ' ' || state == '+') {
+               const char *name = compute_rev_name(path, oid_to_hex(oid));
+
+               if (name)
+                       printf(" (%s)", name);
+       }
 
        printf("\n");
 }