mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(api): deprecated API nvim_get_option does not validate option name #31919
Problem: Deprecated API `nvim_get_option()` doesn't validate the option name, which leads to an assertion failure. Solution: Validate option name in `nvim_get_option()`. Ref: #31894
This commit is contained in:
parent
5135a23219
commit
1e47aa677a
@ -648,6 +648,10 @@ static Object get_option_from(void *from, OptScope scope, String name, Error *er
|
||||
});
|
||||
|
||||
OptIndex opt_idx = find_option(name.data);
|
||||
VALIDATE_S(opt_idx != kOptInvalid, "option name", name.data, {
|
||||
return (Object)OBJECT_INIT;
|
||||
});
|
||||
|
||||
OptVal value = NIL_OPTVAL;
|
||||
|
||||
if (option_has_scope(opt_idx, scope)) {
|
||||
|
Loading…
Reference in New Issue
Block a user