diff options
Diffstat (limited to 'src/oid.c')
| -rw-r--r-- | src/oid.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -95,11 +95,14 @@ char *git_oid_tostr(char *out, size_t n, const git_oid *oid) { char str[GIT_OID_HEXSZ]; - if (!out || n == 0 || !oid) + if (!out || n == 0) return ""; n--; /* allow room for terminating NUL */ + if (oid == NULL) + n = 0; + if (n > 0) { git_oid_fmt(str, oid); if (n > GIT_OID_HEXSZ) |
