diff options
-rw-r--r-- | src/nvim/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_cd.vim | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 9191c2590c..fef254355b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7760,7 +7760,7 @@ bool changedir_func(char_u *new_dir, CdScope scope) char_u *tofree; bool retval = false; - if (allbuf_locked()) { + if (new_dir == NULL || allbuf_locked()) { return false; } diff --git a/src/nvim/testdir/test_cd.vim b/src/nvim/testdir/test_cd.vim index 96c67bd7fc..0421c1d6ff 100644 --- a/src/nvim/testdir/test_cd.vim +++ b/src/nvim/testdir/test_cd.vim @@ -104,6 +104,8 @@ func Test_chdir_func() call assert_fails("call chdir('dir-abcd')", 'E472:') silent! let d = chdir("dir_abcd") call assert_equal("", d) + " Should not crash + call chdir(d) only | tabonly call chdir(topdir) |