fix: nil check for repo cache

This commit is contained in:
Lewis Russell 2024-07-09 15:50:08 +01:00
parent 2593efa3c5
commit 375c44bdfd

View file

@ -136,7 +136,12 @@ end
function M:unref()
local gitdir = self.gitdir
local refcount = repo_cache[gitdir][1]
local repo = repo_cache[gitdir]
if not repo then
-- Already reclaimed by GC
return
end
local refcount = repo[1]
if refcount <= 1 then
repo_cache[gitdir] = nil
else