diff options
Diffstat (limited to 'src/libgit2/oid.c')
-rw-r--r-- | src/libgit2/oid.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libgit2/oid.c b/src/libgit2/oid.c index 6cc21641d..631a566eb 100644 --- a/src/libgit2/oid.c +++ b/src/libgit2/oid.c @@ -155,7 +155,13 @@ int git_oid_pathfmt(char *str, const git_oid *oid) char *git_oid_tostr_s(const git_oid *oid) { - char *str = GIT_THREADSTATE->oid_fmt; + git_threadstate *threadstate = git_threadstate_get(); + char *str; + + if (!threadstate) + return NULL; + + str = threadstate->oid_fmt; git_oid_nfmt(str, git_oid_hexsize(git_oid_type(oid)) + 1, oid); return str; } |