]> git.proxmox.com Git - libgit2.git/blobdiff - src/oid.c
Make git_oid_tostr use out buffer for NULL oid
[libgit2.git] / src / oid.c
index 1bf74b963e7812138cdf77230173d6f9a4f2c34c..bbdd8541bcfbb7fe12be7e3350037f1b1f7c95fb 100644 (file)
--- a/src/oid.c
+++ b/src/oid.c
@@ -95,12 +95,12 @@ 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 (n > 0) {
+       if (n > 0 && oid != NULL) {
                git_oid_fmt(str, oid);
                if (n > GIT_OID_HEXSZ)
                        n = GIT_OID_HEXSZ;