From 679a9d9ac9579bd18225409d85ed4870fb6c9c62 Mon Sep 17 00:00:00 2001 From: cridemichel Date: Thu, 23 Jan 2020 17:06:44 +0100 Subject: [PATCH] Block ProcessFile from processing unloaded or nonexistant buffers (#589) --- autoload/tagbar.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 7b2a7dc..e063083 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1148,6 +1148,17 @@ function! s:ProcessFile(fname, ftype) abort return endif + let l:bufnum = bufnr(a:fname) + + if !bufloaded(l:bufnum) + call tagbar#debug#log('[ProcessFile] Buffer is not loaded exiting...') + return + endif + if !bufexists(l:bufnum) + call tagbar#debug#log('[ProcessFile] Buffer does not exist exiting...') + return + endif + let typeinfo = s:known_types[a:ftype] " If the file has only been updated preserve the fold states, otherwise