summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-17 02:26:22 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-17 02:26:22 +0100
commitcef4c85266f3a3a0f8a02ee595e1221b5b3ac8c0 (patch)
treed8f4b0e5561654e1d30fb0af64f42e336be17af7
parent998d8ef5a4bf37fbdcfef9b55f8d279df6e62855 (diff)
downloadnimgit-cef4c85266f3a3a0f8a02ee595e1221b5b3ac8c0.tar.gz
nimgit-cef4c85266f3a3a0f8a02ee595e1221b5b3ac8c0.tar.bz2
nimgit-cef4c85266f3a3a0f8a02ee595e1221b5b3ac8c0.zip
reference.nim: improve proc ==
-rw-r--r--nimgit/reference.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/nimgit/reference.nim b/nimgit/reference.nim
index 8e59dba..ea3f524 100644
--- 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);