Skip to content

Commit

Permalink
Merge pull request neovim#14607 from glacambre/fix_get_all_options_in…
Browse files Browse the repository at this point in the history
…fo_crash

[RDY] Generate PARAM_COUNT macro
  • Loading branch information
jamessan authored May 26, 2021
2 parents fd91e73 + 0c8454f commit 0b905be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -7705,7 +7705,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));
}
Expand Down
4 changes: 4 additions & 0 deletions test/functional/api/vim_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0b905be

Please sign in to comment.