fix: make sure preview buffer is valid before writing to it (#376)
This commit is contained in:
@@ -35,6 +35,7 @@ utils.job_maker = function(cmd, bufnr, opts)
|
|||||||
args = cmd,
|
args = cmd,
|
||||||
env = opts.env,
|
env = opts.env,
|
||||||
on_exit = vim.schedule_wrap(function(j)
|
on_exit = vim.schedule_wrap(function(j)
|
||||||
|
if not vim.api.nvim_buf_is_valid(bufnr) then return end
|
||||||
if opts.mode == "append" then
|
if opts.mode == "append" then
|
||||||
local count = vim.api.nvim_buf_line_count(bufnr)
|
local count = vim.api.nvim_buf_line_count(bufnr)
|
||||||
vim.api.nvim_buf_set_lines(bufnr, count, -1, false, j:result())
|
vim.api.nvim_buf_set_lines(bufnr, count, -1, false, j:result())
|
||||||
|
|||||||
Reference in New Issue
Block a user