Files
neovim/runtime
xvzc 095b9f98f3 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()`.
2025-10-23 17:34:12 -07:00
..
2025-10-24 02:14:29 +02:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2025-03-26 14:48:09 +01:00