From 820955e77308d2c3d324bde152c0dca9d69c735f Mon Sep 17 00:00:00 2001 From: Phil Runninger Date: Thu, 18 Oct 2018 11:35:00 -0400 Subject: [PATCH] Catch all errors, not just NERDTree errors. (#894) When middle-clicking, the s:TreeFileNode.GetSelected() function is called along the way. If this is done outside of the NERDTree window, there is not "b:NERDTree" variable, and the "E121: Undefined variable" exception is thrown. This function was trying to catch only the NERDTree specific errors; thus, it let the Undefined variable exception slip by. This commit causes the function to catch all errors. --- lib/nerdtree/tree_file_node.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nerdtree/tree_file_node.vim b/lib/nerdtree/tree_file_node.vim index 86aa7a6..52b6193 100644 --- a/lib/nerdtree/tree_file_node.vim +++ b/lib/nerdtree/tree_file_node.vim @@ -180,7 +180,7 @@ function! s:TreeFileNode.GetSelected() endif return b:NERDTree.root.findNode(l:path) - catch /^NERDTree/ + catch return {} endtry endfunction