diff options
| author | xvzc <me@xvzc.dev> | 2025-10-24 09:34:12 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-23 17:34:12 -0700 |
| commit | 095b9f98f3e37b53520c766a12cb413dd0589028 (patch) | |
| tree | 2db6309cdc30fd6cec8dd0a4939ca9cdcc538973 /runtime/lua/vim/_defaults.lua | |
| parent | c05ff026bc8f4e8a1ee48b19ea384f7feb6e2d79 (diff) | |
| download | rneovim-095b9f98f3e37b53520c766a12cb413dd0589028.tar.gz rneovim-095b9f98f3e37b53520c766a12cb413dd0589028.tar.bz2 rneovim-095b9f98f3e37b53520c766a12cb413dd0589028.zip | |
fix(filetype): handle invalid `bufnr` in _getlines(), _getline() #36272
**Problem:**
`vim.filetype.match({ filename = 'a.sh' })` returns `nil` because
an invalid buffer ID is passed to `vim.api.nvim_buf_get_lines()`.
For filetypes like `csh`, `txt`, or any other extensions that call
`_getlines()` or `_getline()` to detect their filetypes, the same
issue occurs.
When only the `filename` argument is passed, an error is raised
inside a `pcall()` that wraps the filetype detection function,
causing it to return no value without showing any error message.
**Solution:**
Validate the `bufnr` value in `_getlines()` and `_getline()`.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
0 files changed, 0 insertions, 0 deletions