Skip to content

Commit

Permalink
fix(text-objects): nil check node's parent
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored and vhyrro committed May 28, 2024
1 parent 8140135 commit 72da6e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/neorg/modules/core/text-objects/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ module.public = {
get_element_from_cursor = function(node_pattern)
local node_at_cursor = vim.treesitter.get_node()

if not node_at_cursor or not node_at_cursor:parent():type():match(node_pattern) then
if
not node_at_cursor
or not node_at_cursor:parent()
or not node_at_cursor:parent():type():match(node_pattern)
then
log.trace(string.format("Could not find element of pattern '%s' under the cursor", node_pattern))
return
end
Expand Down

0 comments on commit 72da6e0

Please sign in to comment.