Skip to content

Commit 59a8a6a

Browse files
fix: invalid explorer on open (#2927)
* fix: use of possibly stale value The return value of `core.get_explorer()` could be changed by `core.init(..)`. * fix style --------- Co-authored-by: Alexander Courtis <[email protected]>
1 parent 0429f28 commit 59a8a6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/nvim-tree/lib.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ end
263263
function M.open(opts)
264264
opts = opts or {}
265265

266-
local explorer = core.get_explorer()
267-
268266
M.set_target_win()
269267
if not core.get_explorer() or opts.path then
270268
if opts.path then
@@ -278,6 +276,9 @@ function M.open(opts)
278276
core.init(cwd)
279277
end
280278
end
279+
280+
local explorer = core.get_explorer()
281+
281282
if should_hijack_current_buf() then
282283
view.close_this_tab_only()
283284
view.open_in_win()

0 commit comments

Comments
 (0)