From d181f2cfd4b828f9c6f1e10e69c68241de59f54f Mon Sep 17 00:00:00 2001 From: Ravi Brock <66334356+ravibrock@users.noreply.github.com> Date: Tue, 28 May 2024 02:48:30 -0500 Subject: [PATCH] fix: add check to ensure that buffer is loaded (#587) --- lua/barbar/events.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/barbar/events.lua b/lua/barbar/events.lua index e8cf7ad2..ae7aed8f 100644 --- a/lua/barbar/events.lua +++ b/lua/barbar/events.lua @@ -222,8 +222,10 @@ function events.enable() create_autocmd('DiagnosticChanged', { callback = function(event) - state.update_diagnostics(event.buf) - render.update() + if vim.api.nvim_buf_is_loaded(event.buf) then + state.update_diagnostics(event.buf) + render.update() + end end, group = augroup_render, })