]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/treesit.el (treesit-node-at): Add check for nil node.
authorYuan Fu <casouri@gmail.com>
Fri, 13 May 2022 23:34:26 +0000 (16:34 -0700)
committerYuan Fu <casouri@gmail.com>
Fri, 13 May 2022 23:34:26 +0000 (16:34 -0700)
lisp/treesit.el

index 345aaf2e9b89c9d64e22896e9fc18415cfa0b530..60f375e9d9258f36137ba38f8028c8ea9ac5c212 100644 (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)