aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/stdlib.c
diff options
context:
space:
mode:
authorRZia <36330543+grassdne@users.noreply.github.com>2022-10-09 20:04:08 -0400
committerGitHub <noreply@github.com>2022-10-10 08:04:08 +0800
commita5597d1fc066a8512ce9434dbff70850dc7bd5a1 (patch)
treec3f1f1cf174c8b67e4be41ee8a781734fadcc4ec /src/nvim/lua/stdlib.c
parent9d0ed754d5a8e6b442e1da2a153422dcee9004e1 (diff)
downloadrneovim-a5597d1fc066a8512ce9434dbff70850dc7bd5a1.tar.gz
rneovim-a5597d1fc066a8512ce9434dbff70850dc7bd5a1.tar.bz2
rneovim-a5597d1fc066a8512ce9434dbff70850dc7bd5a1.zip
fix(lua): assert failure with vim.regex() error inside :silent! (#20555)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/nvim/lua/stdlib.c')
-rw-r--r--src/nvim/lua/stdlib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 498f956ed9..2f46f6ff65 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -304,8 +304,10 @@ int nlua_regex(lua_State *lstate)
nlua_push_errstr(lstate, "couldn't parse regex: %s", err.msg);
api_clear_error(&err);
return lua_error(lstate);
+ } else if (prog == NULL) {
+ nlua_push_errstr(lstate, "couldn't parse regex");
+ return lua_error(lstate);
}
- assert(prog);
regprog_T **p = lua_newuserdata(lstate, sizeof(regprog_T *));
*p = prog;