[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 750090fd07 4/5: * lisp/treesit.el (treesit-node-at):
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 750090fd07 4/5: * lisp/treesit.el (treesit-node-at): Add check for nil node. |
Date: |
Sat, 14 May 2022 01:12:02 -0400 (EDT) |
branch: feature/tree-sitter
commit 750090fd076e6923c5cee6f67b170416d48694da
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
* lisp/treesit.el (treesit-node-at): Add check for nil node.
---
lisp/treesit.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 345aaf2e9b..60f375e9d9 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -143,7 +143,7 @@ that language in the current buffer, and use that."
(treesit-parser-root-node parser-or-lang)
(treesit-buffer-root-node parser-or-lang))))
;; TODO: We might want a `treesit-node-decendant-for-pos' in C.
- (while (cond ((< (treesit-node-end node) point)
+ (while (cond ((and node (< (treesit-node-end node) point))
(setq node (treesit-node-next-sibling node))
t)
((treesit-node-child node 0 named)