diff options
-rw-r--r-- | src/nvim/mapping.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/test_maparg.vim | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index cbbe07635f..0bb397c748 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -2132,8 +2132,11 @@ void f_mapset(typval_T *argvars, typval_T *rettv, FunPtr fptr) { char buf[NUMBUFLEN]; const char *which = tv_get_string_buf_chk(&argvars[0], buf); - int mode = get_map_mode((char **)&which, 0); - bool is_abbr = tv_get_number(&argvars[1]) != 0; + if (which == NULL) { + return; + } + const int mode = get_map_mode((char **)&which, 0); + const bool is_abbr = tv_get_number(&argvars[1]) != 0; if (argvars[2].v_type != VAR_DICT) { emsg(_(e_dictreq)); diff --git a/src/nvim/testdir/test_maparg.vim b/src/nvim/testdir/test_maparg.vim index abbee7db95..6b69def374 100644 --- a/src/nvim/testdir/test_maparg.vim +++ b/src/nvim/testdir/test_maparg.vim @@ -239,6 +239,8 @@ func Test_mapset() iunmap K let &cpo = cpo_save bwipe! + + call assert_fails('call mapset([], v:false, {})', 'E730:') endfunc func Check_ctrlb_map(d, check_alt) |