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.
This commit is contained in:
Phil Runninger 2018-10-18 11:35:00 -04:00 committed by GitHub
parent 5381197747
commit 820955e773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,7 +180,7 @@ function! s:TreeFileNode.GetSelected()
endif endif
return b:NERDTree.root.findNode(l:path) return b:NERDTree.root.findNode(l:path)
catch /^NERDTree/ catch
return {} return {}
endtry endtry
endfunction endfunction