From 72da6e0773298356f5a83ce52c9efdd88d4147e5 Mon Sep 17 00:00:00 2001 From: benlubas Date: Wed, 22 May 2024 08:28:05 -0600 Subject: [PATCH] fix(text-objects): nil check node's parent --- lua/neorg/modules/core/text-objects/module.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/neorg/modules/core/text-objects/module.lua b/lua/neorg/modules/core/text-objects/module.lua index a10eb476a..8187f6c9e 100644 --- a/lua/neorg/modules/core/text-objects/module.lua +++ b/lua/neorg/modules/core/text-objects/module.lua @@ -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