From 2301b3675f4d12e960856a594880f5a59dfdbc0d Mon Sep 17 00:00:00 2001 From: kiyan Date: Sun, 5 Dec 2021 22:50:43 +0100 Subject: [PATCH] fix(git): check handle before accessing it Fixes #814 Should fix #816 --- lua/nvim-tree/git/runner.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/git/runner.lua b/lua/nvim-tree/git/runner.lua index c958dee9..0c2d7726 100644 --- a/lua/nvim-tree/git/runner.lua +++ b/lua/nvim-tree/git/runner.lua @@ -52,14 +52,17 @@ function Runner:_run_git_job() local timer = uv.new_timer() local function on_finish(output) - if timer:is_closing() or stdout:is_closing() or handle:is_closing() then + if timer:is_closing() or stdout:is_closing() or (handle and handle:is_closing()) then return end timer:stop() timer:close() stdout:read_stop() stdout:close() - handle:close() + if handle then + handle:close() + end + pcall(uv.kill, pid) self.on_end(output or self.output)