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:
Famiu Haque authored and GitHub committed 2025-01-09 07:32:27 -08:00
1 parent 5135a23219
commit 1e47aa677a
1 file changed
+4
+4
View File
@@ -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)) {