Files
neovim/test/functional/lua
xvzc 0e1c83fae2 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()`.

(cherry picked from commit 095b9f98f3)
2025-10-24 01:14:30 +00:00
..
2024-04-23 18:17:04 +02:00
2025-01-09 09:26:45 -08:00
2025-03-14 09:09:16 +00:00
2024-04-23 18:17:04 +02:00
2025-03-02 14:27:52 -08:00