From f15af583ebdce3c1b89cdfec05664c84e3d3ff51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Mu=C3=B1oz?= Date: Fri, 1 Jan 2021 20:42:36 +0100 Subject: [PATCH] fix: make sure preview buffer is valid before writing to it (#376) --- lua/telescope/previewers/utils.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/telescope/previewers/utils.lua b/lua/telescope/previewers/utils.lua index 2c36a76..29ef1c0 100644 --- a/lua/telescope/previewers/utils.lua +++ b/lua/telescope/previewers/utils.lua @@ -35,6 +35,7 @@ utils.job_maker = function(cmd, bufnr, opts) args = cmd, env = opts.env, on_exit = vim.schedule_wrap(function(j) + if not vim.api.nvim_buf_is_valid(bufnr) then return end if opts.mode == "append" then local count = vim.api.nvim_buf_line_count(bufnr) vim.api.nvim_buf_set_lines(bufnr, count, -1, false, j:result())