eval/encode: Fail when stringifying NULL functions

This commit is contained in:
ZyX 2017-01-03 16:13:21 +03:00
parent 06cca5dc59
commit f21725946c

View File

@ -336,8 +336,14 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \ #define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
do { \ do { \
ga_concat(gap, "function("); \ const char *const fun_ = (const char *)(fun); \
TYPVAL_ENCODE_CONV_STRING(tv, fun, STRLEN(fun)); \ if (fun_ == NULL) { \
EMSG2(_(e_intern2), "string(): NULL function name"); \
ga_concat(gap, "function(NULL"); \
} else { \
ga_concat(gap, "function("); \
TYPVAL_ENCODE_CONV_STRING(tv, fun_, strlen(fun_)); \
}\
} while (0) } while (0)
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) \ #define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) \