From 81b2c5f04ae24a8c83b20ecbd017fecac15faca0 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Fri, 24 Jan 2025 16:22:21 -0800 Subject: [PATCH] fix: crash in preview on nvim 0.8 --- lua/oil/util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/oil/util.lua b/lua/oil/util.lua index a86981a..b5e57e5 100644 --- a/lua/oil/util.lua +++ b/lua/oil/util.lua @@ -926,7 +926,7 @@ M.read_file_to_scratch_buffer = function(path, preview_method) return end local ft = vim.filetype.match({ filename = path, buf = bufnr }) - if ft and ft ~= "" then + if ft and ft ~= "" and vim.treesitter.language.get_lang then local lang = vim.treesitter.language.get_lang(ft) if not pcall(vim.treesitter.start, bufnr, lang) then vim.bo[bufnr].syntax = ft