Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/oid.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-04 02:21:25 +0400
committerRussell Belfer <rb@github.com>2013-01-05 03:47:44 +0400
commit1b88faf7aea53a72a4906f48ec30f16f1c157503 (patch)
treee1371c0a6ff7fd318a93e6d38e5da14a4be9bec8 /src/oid.c
parentd8889d2b64a0a28f33a189216e1d63669b9be206 (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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/oid.c b/src/oid.c
index bbdd8541b..474129b58 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -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;