fix: use guard clause

This commit is contained in:
Barrett Ruth 2026-03-02 19:26:02 -05:00
parent 262bf8710e
commit 05234a67ba
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -974,7 +974,11 @@ M.get_icon_provider = function()
end end
local has_devicons, devicons = pcall(require, 'nvim-web-devicons') local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
if has_devicons then
if not has_devicons then
return
end
return function(type, name, conf, ft) return function(type, name, conf, ft)
if type == 'directory' then if type == 'directory' then
return conf and conf.directory or '', 'OilDirIcon' return conf and conf.directory or '', 'OilDirIcon'
@ -992,7 +996,6 @@ M.get_icon_provider = function()
end end
end end
end end
end
---Read a buffer into a scratch buffer and apply syntactic highlighting when possible ---Read a buffer into a scratch buffer and apply syntactic highlighting when possible
---@param path string The path to the file to read ---@param path string The path to the file to read