prevent indexing nil vals in ensure_correct_config

This commit is contained in:
Raigo Jerva 2021-05-12 11:51:13 +03:00
parent fae9f7d14b
commit f139d79a75
No known key found for this signature in database
GPG Key ID: 2156679E782853EC
2 changed files with 8 additions and 7 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

@ -264,16 +264,17 @@ M.get_marked_file_name = function(idx)
end
M.get_length = function()
log.trace("get_length()")
return table.maxn(harpoon.get_mark_config().marks)
log.trace("M.get_length()")
local length = table.maxn(harpoon.get_mark_config().marks)
log.debug("M.get_length():", length)
return length
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