diff src/if_lua.c @ 25509:7ed54019fbb8 v8.2.3291

patch 8.2.3291: Coverity warns for not checking return value Commit: https://github.com/vim/vim/commit/4a01159da23a279005b7c5042a15af47eb9617fe Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 5 15:11:08 2021 +0200 patch 8.2.3291: Coverity warns for not checking return value Problem: Coverity warns for not checking return value. Solution: If dict_add() fails give an error message.
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Aug 2021 15:15:06 +0200
parents 9947b7e4b319
children d84f6784c27c
line wrap: on
line diff
--- 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