From 633811c53d3b7856cab8e96b91c6a5d2cf9eb8ae Mon Sep 17 00:00:00 2001 From: Matt W Date: Sat, 18 Nov 2023 19:43:36 -0800 Subject: [PATCH] fix: harden git status updates (#2533) * fix for nil status error messages * simplify logic --------- Co-authored-by: Alexander Courtis --- lua/nvim-tree/explorer/node.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/nvim-tree/explorer/node.lua b/lua/nvim-tree/explorer/node.lua index 3d0119be..3a84e6e7 100644 --- a/lua/nvim-tree/explorer/node.lua +++ b/lua/nvim-tree/explorer/node.lua @@ -14,13 +14,15 @@ local function get_dir_git_status(parent_ignored, status, absolute_path) return { file = "!!" } end - return { - file = status.files and status.files[absolute_path], - dir = status.dirs and { - direct = status.dirs.direct[absolute_path], - indirect = status.dirs.indirect[absolute_path], - }, - } + if status then + return { + file = status.files and status.files[absolute_path], + dir = status.dirs and { + direct = status.dirs.direct[absolute_path], + indirect = status.dirs.indirect[absolute_path], + }, + } + end end local function get_git_status(parent_ignored, status, absolute_path)