diff --git a/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua b/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua index 6aaec1b6a83..db9518c145d 100644 --- a/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua +++ b/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua @@ -31,7 +31,9 @@ function M.fn(keep_buffers) Iterator.builder(core.get_explorer().nodes) :hidden() :applier(function(node) - node.open = keep_buffers == true and matches(node.absolute_path) + if node.nodes ~= nil then + node.open = keep_buffers == true and matches(node.absolute_path) + end end) :recursor(function(n) return n.nodes