aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/memline.c6
-rw-r--r--src/nvim/testdir/test_recover.vim6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index f1d6ee064c..b85c23e50f 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -523,9 +523,9 @@ void ml_open_file(buf_T *buf)
}
}
- if (mfp->mf_fname == NULL) { /* Failed! */
- need_wait_return = TRUE; /* call wait_return later */
- ++no_wait_return;
+ if (*p_dir != NUL && mfp->mf_fname == NULL) {
+ need_wait_return = true; // call wait_return later
+ no_wait_return++;
(void)EMSG2(_(
"E303: Unable to open swap file for \"%s\", recovery impossible"),
buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
diff --git a/src/nvim/testdir/test_recover.vim b/src/nvim/testdir/test_recover.vim
index 09c8d1cda6..fc073cacd2 100644
--- a/src/nvim/testdir/test_recover.vim
+++ b/src/nvim/testdir/test_recover.vim
@@ -14,6 +14,12 @@ func Test_recover_root_dir()
set dir=/notexist/
endif
call assert_fails('split Xtest', 'E303:')
+
+ " No error with empty 'directory' setting.
+ set directory=
+ split XtestOK
+ close!
+
set dir&
endfunc