mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
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.
This commit is contained in:
parent
75992f2ad9
commit
0c8454f5bc
@ -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));
|
||||
}
|
||||
|
@ -1986,6 +1986,10 @@ describe('API', function()
|
||||
|
||||
eq(meths.get_option_info'winhighlight', options_info.winhighlight)
|
||||
end)
|
||||
|
||||
it('should not crash when echoed', function()
|
||||
meths.exec("echo nvim_get_all_options_info()", true)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('nvim_get_option_info', function()
|
||||
|
Loading…
Reference in New Issue
Block a user