diff options
-rw-r--r-- | src/if_lua.c | 3 | ||||
-rw-r--r-- | src/testdir/test_lua.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/if_lua.c b/src/if_lua.c index bcd0b02f97..144fcbea5f 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -1862,7 +1862,8 @@ luaV_setvar(lua_State *L) return 0; // Update the value copy_tv(&tv, &di->di_tv); - dict_add(dict, di); + if (dict_add(dict, di) == FAIL) + return luaL_error(L, "Couldn't add to dictionary"); } else { // Clear the old value diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim index 953e8a9b67..94e3ceccc0 100644 --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -1009,6 +1009,10 @@ func Test_lua_global_var_table() call assert_fails('lua vim.g.Var2[3] = 21', 'list is locked') unlockvar g:Var2 + let g:TestFunc = function('len') + call assert_fails('lua vim.g.func = vim.g.TestFunc', ['E704:', 'Couldn''t add to dictionary']) + unlet g:TestFunc + " Attempt to access a non-existing global variable call assert_equal(v:null, luaeval('vim.g.NonExistingVar')) lua vim.g.NonExisting = Nil diff --git a/src/version.c b/src/version.c index 905bc4eec0..b88b7503ac 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3291, +/**/ 3290, /**/ 3289, |