Skip to content

Commit

Permalink
fix: use of possibly stale value
Browse files Browse the repository at this point in the history
The return value of `core.get_explorer()` could be changed by `core.init(..)`.
  • Loading branch information
TinusgragLin authored Sep 23, 2024
1 parent 8405ecf commit a2e19be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/nvim-tree/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@ end
function M.open(opts)
opts = opts or {}

local explorer = core.get_explorer()

M.set_target_win()
if not core.get_explorer() or opts.path then
if opts.path then
Expand All @@ -278,6 +276,9 @@ function M.open(opts)
core.init(cwd)
end
end

local explorer = core.get_explorer()

if should_hijack_current_buf() then
view.close_this_tab_only()
view.open_in_win()
Expand Down

0 comments on commit a2e19be

Please sign in to comment.