fix: git branches previewer add nil check to cend (#478)

Co-authored-by: Corentin Brunel <cbrunel@localhost.localdomain>
This commit is contained in:
Corentin Brunel
2021-01-30 04:16:17 -05:00
committed by GitHub
parent 0ae5991385
commit 2a5db2f4f1

View File

@@ -403,7 +403,9 @@ previewers.git_branch_log = defaulter(function(_)
local _, cstart = line:find('- %(') local _, cstart = line:find('- %(')
if cstart then if cstart then
local cend = string.find(line, '%) ') local cend = string.find(line, '%) ')
vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, "TelescopeResultsConstant", i - 1, cstart - 1, cend) if cend then
vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, "TelescopeResultsConstant", i - 1, cstart - 1, cend)
end
end end
local dstart, _ = line:find(' %(%d') local dstart, _ = line:find(' %(%d')
if dstart then if dstart then