aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/install.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index e830a1afd..817514115 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -33,7 +33,8 @@ end
local function get_revision(lang)
if #lockfile == 0 then
- lockfile = vim.fn.json_decode(vim.fn.readfile(utils.join_path(utils.get_package_path(), 'lockfile.json')))
+ local filename = utils.join_path(utils.get_package_path(), 'lockfile.json')
+ lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {}
end
return (lockfile[lang] and lockfile[lang].revision)
end