* lisp/treesit.el (treesit-node-at): Add check for nil node.

This commit is contained in:
Yuan Fu 2022-05-13 16:34:26 -07:00
parent d8c9b9c0fb
commit 750090fd07
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -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)