chore: add guards to prepare setup refactoring
This commit is contained in:
@@ -10,6 +10,8 @@ local M = {
|
||||
}
|
||||
|
||||
function M.fn(name)
|
||||
if not TreeExplorer then return end
|
||||
|
||||
local foldername = name == '..' and vim.fn.fnamemodify(utils.path_remove_trailing(TreeExplorer.cwd), ':h') or name
|
||||
local no_cwd_change = vim.fn.expand(foldername) == TreeExplorer.cwd
|
||||
local new_tab = a.nvim_get_current_tabpage()
|
||||
|
||||
@@ -33,7 +33,7 @@ end
|
||||
|
||||
local event_running = false
|
||||
function M.reload_explorer(callback)
|
||||
if event_running or not TreeExplorer.cwd or vim.v.exiting ~= vim.NIL then
|
||||
if event_running or not TreeExplorer or not TreeExplorer.cwd or vim.v.exiting ~= vim.NIL then
|
||||
return
|
||||
end
|
||||
event_running = true
|
||||
@@ -52,7 +52,7 @@ function M.reload_explorer(callback)
|
||||
end
|
||||
|
||||
function M.reload_git()
|
||||
if not git.config.enable or event_running then
|
||||
if not TreeExplorer or not git.config.enable or event_running then
|
||||
return
|
||||
end
|
||||
event_running = true
|
||||
|
||||
Reference in New Issue
Block a user