diff --git a/CHANGELOG.md b/CHANGELOG.md index 8795c6b1..239ce815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log #### 6.1... +- **.2**: Wrap saveScreenState's statements in a try-catch block. (PhilRunninger) [#1047](https://github.com/scrooloose/nerdtree/pull/1047) - **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/scrooloose/nerdtree/pull/1045) - **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043) #### 6.0... diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim index d384071d..5e8b3b64 100644 --- a/lib/nerdtree/ui.vim +++ b/lib/nerdtree/ui.vim @@ -355,12 +355,15 @@ endfunction " scroll position function! s:UI.saveScreenState() let win = winnr() - call g:NERDTree.CursorToTreeWin() let self._screenState = {} - let self._screenState['oldPos'] = getpos(".") - let self._screenState['oldTopLine'] = line("w0") - let self._screenState['oldWindowSize']= winwidth("") - call nerdtree#exec(win . "wincmd w", 1) + try + call g:NERDTree.CursorToTreeWin() + let self._screenState['oldPos'] = getpos(".") + let self._screenState['oldTopLine'] = line("w0") + let self._screenState['oldWindowSize']= winwidth("") + call nerdtree#exec(win . "wincmd w", 1) + catch + endtry endfunction " FUNCTION: s:UI.setShowHidden(val) {{{1