diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b7f5d93bf3..0b81e10bd9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1912,6 +1912,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, if ((opt_type == 1 && *op == '.') || (opt_type == 0 && *op != '.')) { EMSG2(_(e_letwrong), op); + s = NULL; // don't set the value } else { if (opt_type == 1) { // number if (*op == '+') { diff --git a/src/nvim/testdir/test_assign.vim b/src/nvim/testdir/test_assign.vim index a75e89d5dd..50415ad6fd 100644 --- a/src/nvim/testdir/test_assign.vim +++ b/src/nvim/testdir/test_assign.vim @@ -31,3 +31,17 @@ func Test_let_termcap() let &t_xx = "" call assert_fails('let x = &t_xx', 'E15') endfunc + +func Test_let_option_error() + let _w = &tw + let &tw = 80 + call assert_fails('let &tw .= 1', 'E734') + call assert_equal(80, &tw) + let &tw = _w + + let _w = &fillchars + let &fillchars = "vert:|" + call assert_fails('let &fillchars += "diff:-"', 'E734') + call assert_equal("vert:|", &fillchars) + let &fillchars = _w +endfunc