Skip to content

Commit c7ff4c3

Browse files
authored
fix: nil-check filename before attempting to sub (#23)
1 parent 1ecb68b commit c7ff4c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugin/hmts.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ end
9696
local function find_filename_in_parent_node(path_node, bufnr)
9797
local text = vim.treesitter.get_node_text(path_node, bufnr)
9898
local _, _, filename = string.find(text, "(.*)%.text$")
99+
100+
if filename == nil then
101+
return nil
102+
end
103+
99104
filename = string.sub(filename, 2, -2)
100105

101106
if filename ~= nil then

0 commit comments

Comments
 (0)