Skip to content

Commit

Permalink
fix(compat): add missing nil checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Oct 31, 2023
1 parent f7415da commit 8ee705b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/rustaceanvim/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ M.uv = vim.uv or vim.loop
M.system = vim.system
-- wrapper around vim.fn.system to give it a similar API to vim.system
or function(cmd, opts, on_exit)
if opts.cwd then
if opts and opts.cwd then
local shell = require('rustaceanvim.shell')
cmd = shell.chain_commands { 'cd ' .. opts.cwd, table.concat(cmd, ' ') }
---@cast cmd string
Expand All @@ -35,7 +35,9 @@ M.system = vim.system
stderr = not ok and (output or '') or nil,
code = vim.v.shell_error,
}
on_exit(systemObj)
if on_exit then
on_exit(systemObj)
end
return systemObj
end

Expand Down

0 comments on commit 8ee705b

Please sign in to comment.