mirror of
https://github.com/neovim/neovim.git
synced 2026-01-08 04:18:49 +10:00
fix(api,lua): handle converting NULL funcref/partial (#37060)
This fixes the Coverity warnings.
This commit is contained in:
@@ -76,8 +76,9 @@ static Object typval_cbuf_to_obj(EncodedData *edata, const char *data, size_t le
|
||||
|
||||
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun, prefix) \
|
||||
do { \
|
||||
ufunc_T *fp = find_func(fun); \
|
||||
if (fp != NULL && (fp->uf_flags & FC_LUAREF)) { \
|
||||
const char *const fun_ = (fun); \
|
||||
ufunc_T *fp; \
|
||||
if (fun_ != NULL && (fp = find_func(fun_)) != NULL && fp->uf_flags & FC_LUAREF) { \
|
||||
kvi_push(edata->stack, LUAREF_OBJ(api_new_luaref(fp->uf_luaref))); \
|
||||
} else { \
|
||||
TYPVAL_ENCODE_CONV_NIL(tv); \
|
||||
|
||||
@@ -455,8 +455,9 @@ static bool typval_conv_special = false;
|
||||
|
||||
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun, prefix) \
|
||||
do { \
|
||||
ufunc_T *fp = find_func(fun); \
|
||||
if (fp != NULL && fp->uf_flags & FC_LUAREF) { \
|
||||
const char *const fun_ = (fun); \
|
||||
ufunc_T *fp; \
|
||||
if (fun_ != NULL && (fp = find_func(fun_)) != NULL && fp->uf_flags & FC_LUAREF) { \
|
||||
nlua_pushref(lstate, fp->uf_luaref); \
|
||||
} else { \
|
||||
TYPVAL_ENCODE_CONV_NIL(tv); \
|
||||
|
||||
Reference in New Issue
Block a user