Skip to content

Commit 035e5d6

Browse files
committed
prevent empty split when calling NERDTreeExplorer with invalid arg from modified buffer
1 parent 5b36ce5 commit 035e5d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/nerdtree/creator.vim

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ endfunction
4040

4141
" FUNCTION: s:Creator.CreateExplorerTree(dir) {{{1
4242
function! s:Creator.CreateExplorerTree(dir)
43+
try
44+
let path = g:NERDTreePath.New(a:dir)
45+
catch /^NERDTree.InvalidArgumentsError/
46+
call nerdtree#echo('Invalid directory name:' . a:dir)
47+
return
48+
endtry
49+
4350
let creator = s:Creator.New()
4451
if getbufinfo('%')[0].changed
4552
let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright '

0 commit comments

Comments
 (0)