Files
neovim/runtime/lua/vim
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:07:37 +02:00
2025-08-17 11:54:53 +08:00
2025-10-12 12:16:14 +08:00
2025-06-06 15:36:48 +01:00
2025-07-10 21:50:46 -04:00
2025-10-24 02:07:37 +02:00
2025-09-16 11:41:36 +08:00
2025-10-23 20:28:13 +03:00
2025-09-16 11:41:36 +08:00
2025-10-24 02:07:37 +02:00
2025-09-16 11:41:36 +08:00
2025-06-14 17:24:36 +02:00