From ce5dd1aaa210ec41010ea7f13ba2ca8450d1b455 Mon Sep 17 00:00:00 2001 From: Harrison Cramer Date: Fri, 18 Aug 2023 21:38:27 -0400 Subject: [PATCH] Fixes #28 We do not want to attempt to refresh the discussion tree if the buffer has been deleted. --- lua/gitlab/discussions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/gitlab/discussions.lua b/lua/gitlab/discussions.lua index 0336cde..db6b0e8 100644 --- a/lua/gitlab/discussions.lua +++ b/lua/gitlab/discussions.lua @@ -195,7 +195,7 @@ M.refresh_tree = function() return end - if not state.SPLIT_BUF then return end + if not state.SPLIT_BUF or (vim.fn.bufwinid(state.SPLIT_BUF) == -1) then return end vim.api.nvim_buf_set_option(state.SPLIT_BUF, 'modifiable', true) vim.api.nvim_buf_set_option(state.SPLIT_BUF, 'readonly', false)