mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
fix(api): nvim_get_option_value does not clean up on FileType error #31219
Problem: If there's an error in `FileType` autocmd, the filetype get-opt buffer doesn't get cleaned up. Solution: Call `aucmd_restbuf`.
This commit is contained in:
@@ -165,6 +165,14 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
|
||||
|
||||
buf_T *ftbuf = do_ft_buf(filetype, &aco, err);
|
||||
if (ERROR_SET(err)) {
|
||||
if (ftbuf != NULL) {
|
||||
// restore curwin/curbuf and a few other things
|
||||
aucmd_restbuf(&aco);
|
||||
|
||||
assert(curbuf != ftbuf); // safety check
|
||||
wipe_buffer(ftbuf, false);
|
||||
}
|
||||
|
||||
return (Object)OBJECT_INIT;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user