Skip to content

Commit

Permalink
fix: prevent format-on-save autocmd from running on invalid buffers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbellboy authored Oct 10, 2023
1 parent fcd272c commit 69ee0bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/conform/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ M.setup = function(opts)
pattern = "*",
group = aug,
callback = function(args)
if vim.bo[args.buf].buftype ~= "" then
if not vim.api.nvim_buf_is_valid(args.buf) or vim.bo[args.buf].buftype ~= "" then
return
end
local format_args, callback = opts.format_on_save, nil
Expand Down

0 comments on commit 69ee0bf

Please sign in to comment.