Merge pull request #81 from rudotriton/fix-indexing-nils

prevent indexing nil vals in ensure_correct_config
This commit is contained in:
ThePrimeagen 2021-05-12 11:25:44 -06:00 committed by GitHub
commit beb361aaf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -88,8 +88,8 @@ local function ensure_correct_config(config)
end
local marks = proj.mark.marks
for idx = 1, #marks do
local mark = marks[idx]
for idx, mark in pairs(marks) do
if type(mark) == "string" then
mark = {
filename = mark,

View File

@ -269,11 +269,10 @@ M.get_length = function()
end
M.set_current_at = function(idx)
local config = harpoon.get_mark_config()
local buf_name = get_buf_name()
local current_idx = M.get_index_of(buf_name)
log.trace("set_current_at(): Setting id", idx, buf_name)
local config = harpoon.get_mark_config()
local current_idx = M.get_index_of(buf_name)
-- Remove it if it already exists
if M.valid_index(current_idx) then