diff options
author | Russell Belfer <rb@github.com> | 2013-01-04 02:21:25 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-01-05 03:47:44 +0400 |
commit | 1b88faf7aea53a72a4906f48ec30f16f1c157503 (patch) | |
tree | e1371c0a6ff7fd318a93e6d38e5da14a4be9bec8 /src/oid.c | |
parent | d8889d2b64a0a28f33a189216e1d63669b9be206 (diff) |
Fix oid tostr issue with NULL oid
I made a small change to the behavior of this code and apparently
got it wrong. Sigh.
Diffstat (limited to 'src/oid.c')
-rw-r--r-- | src/oid.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -100,7 +100,10 @@ char *git_oid_tostr(char *out, size_t n, const git_oid *oid) n--; /* allow room for terminating NUL */ - if (n > 0 && oid != NULL) { + if (oid == NULL) + n = 0; + + if (n > 0) { git_oid_fmt(str, oid); if (n > GIT_OID_HEXSZ) n = GIT_OID_HEXSZ; |