[Backport release-0.8] fix(lua): assert failure with vim.regex() error inside :silent! (#20560)

Co-authored-by: Rustum Zia <ziarustum@gmail.com>
Co-authored-by: RZia <36330543+grassdne@users.noreply.github.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
github-actions[bot]
2022-10-10 08:43:57 +08:00
committed by GitHub
parent 2ad8d36b89
commit 126e434fec
2 changed files with 8 additions and 1 deletions

View File

@@ -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;