downcase predicate: nil protection

get_node_text could be nil if the range is invalid.

With https://github.com/neovim/neovim/pull/15030/
this fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/1531
This commit is contained in:
Santos Gallegos 2021-07-08 23:23:37 -05:00 committed by Stephan Seitz
parent 08c6a3fb55
commit 8eb8cc61e3

View file

@ -119,7 +119,7 @@ query.add_directive("downcase!", function(match, _, bufnr, pred, metadata)
text = value
else
local node = match[value]
text = query.get_node_text(node, bufnr)
text = query.get_node_text(node, bufnr) or ""
end
if #pred == 3 then