Skip to content

Commit 72da6e0

Browse files
benlubasvhyrro
authored andcommitted
fix(text-objects): nil check node's parent
1 parent 8140135 commit 72da6e0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/neorg/modules/core/text-objects/module.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ module.public = {
113113
get_element_from_cursor = function(node_pattern)
114114
local node_at_cursor = vim.treesitter.get_node()
115115

116-
if not node_at_cursor or not node_at_cursor:parent():type():match(node_pattern) then
116+
if
117+
not node_at_cursor
118+
or not node_at_cursor:parent()
119+
or not node_at_cursor:parent():type():match(node_pattern)
120+
then
117121
log.trace(string.format("Could not find element of pattern '%s' under the cursor", node_pattern))
118122
return
119123
end

0 commit comments

Comments
 (0)