fix(image): check for invalid buffer

This commit is contained in:
Shizuka 2025-11-01 09:28:16 +04:00 committed by GitHub
parent 78c875b222
commit 9ad41782ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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