mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(image): check for invalid buffer
This commit is contained in:
parent
78c875b222
commit
9ad41782ec
1 changed files with 3 additions and 0 deletions
|
|
@ -5,6 +5,9 @@ local M = {}
|
|||
---@param opts? snacks.image.Opts|{src?: string}
|
||||
function M._attach(buf, opts)
|
||||
Snacks.image.placement.clean(buf)
|
||||
if not vim.api.nvim_buf_is_valid(buf) then
|
||||
return
|
||||
end
|
||||
opts = opts or {}
|
||||
local file = opts.src or vim.api.nvim_buf_get_name(buf)
|
||||
if not Snacks.image.supports(file) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue