Skip to content

Commit

Permalink
fix: Wrap get_parser with a pcall
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewferrier committed May 25, 2024
1 parent 396e47c commit eb62d18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/wrapping/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ M.count_lines_of_query = function(language, query)
end

local buf = vim.api.nvim_win_get_buf(0)
local root_lang_tree = parsers.get_parser(buf)
local status, root_lang_tree = pcall(parsers.get_parser, buf)

if not root_lang_tree then
if not status or not root_lang_tree then
return total_lines, total_chars
end

Expand Down

0 comments on commit eb62d18

Please sign in to comment.