From 0c8454f5bc5c40a2d2926f4b630a8519731fd7ae Mon Sep 17 00:00:00 2001 From: glacambre Date: Tue, 25 May 2021 07:06:50 +0200 Subject: Fix crash on `:echo get_all_options_info()` Iterating over PARAM_COUNT is wrong as PARAM_COUNT also counts the last element of the options array, which has a NULL fullname in order to signal the end of the array. --- src/nvim/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/option.c b/src/nvim/option.c index ad481af7fa..8f8a57caf2 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -7700,7 +7700,7 @@ Dictionary get_vimoption(String name, Error *err) Dictionary get_all_vimoptions(void) { Dictionary retval = ARRAY_DICT_INIT; - for (size_t i = 0; i < PARAM_COUNT; i++) { + for (size_t i = 0; options[i].fullname != NULL; i++) { Dictionary opt_dict = vimoption2dict(&options[i]); PUT(retval, options[i].fullname, DICTIONARY_OBJ(opt_dict)); } -- cgit