commit 7a20f93a929abda22f979e92fd75b92e447d1e2a
parent a9e725b26e08f494a9300d8f63acd3efa9c2da82
Author: Amaan Qureshi <amaanq12@gmail.com>
Date: Sun, 27 Oct 2024 13:02:31 -0400
fix(treesitter): correct condition in `__has_ancestor`
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
@@ -1151,7 +1151,7 @@ static int __has_ancestor(lua_State *L)
int const pred_len = (int)lua_objlen(L, 2);
TSNode node = ts_tree_root_node(descendant.tree);
- while (node.id != descendant.id) {
+ while (node.id != descendant.id && !ts_node_is_null(node)) {
char const *node_type = ts_node_type(node);
size_t node_type_len = strlen(node_type);