Skip to content

Commit

Permalink
fix: nil check for repo info
Browse files Browse the repository at this point in the history
Fixes #1085 #1086
  • Loading branch information
lewis6991 committed Jul 12, 2024
1 parent 7178d1a commit e784e5a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/gitsigns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ local M = {}
local cwd_watcher ---@type uv.uv_fs_event_t?

--- @async
--- @return string gitdir
--- @return string head
--- @return string? gitdir
--- @return string? head
local function get_gitdir_and_head()
local cwd = assert(uv.cwd())

Expand All @@ -31,7 +31,9 @@ local function get_gitdir_and_head()

local info = require('gitsigns.git').Repo.get_info(cwd)

return info.gitdir, info.abbrev_head
if info then
return info.gitdir, info.abbrev_head
end
end

local update_cwd_head = async.create(function()
Expand Down

0 comments on commit e784e5a

Please sign in to comment.