aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/encode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index ef1e77459a..828bde3124 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -336,8 +336,14 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
do { \
- ga_concat(gap, "function("); \
- TYPVAL_ENCODE_CONV_STRING(tv, fun, STRLEN(fun)); \
+ const char *const fun_ = (const char *)(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)
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) \