commit cef4c85266f3a3a0f8a02ee595e1221b5b3ac8c0
parent 998d8ef5a4bf37fbdcfef9b55f8d279df6e62855
Author: Leah (ctucx) <leah@ctu.cx>
Date: Wed, 17 Mar 2021 02:26:22 +0100
parent 998d8ef5a4bf37fbdcfef9b55f8d279df6e62855
Author: Leah (ctucx) <leah@ctu.cx>
Date: Wed, 17 Mar 2021 02:26:22 +0100
reference.nim: improve proc ==
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/nimgit/reference.nim b/nimgit/reference.nim @@ -55,7 +55,10 @@ proc getGitReferenceNames* (repo: GitRepository): seq[string] = free(addr gitRefsArr) raise newException(CatchableError, "Cannot get reference-names: " & $error.getResultCode) - result = cstringArrayToSeq(cast[cstringArray](gitRefsArr.strings), gitRefsArr.count) + if gitRefsArr.count == 0'u: + result = newSeq[string]() + else: + result = cstringArrayToSeq(cast[cstringArray](gitRefsArr.strings), gitRefsArr.count) free(addr gitRefsArr);