Skip to content

Commit

Permalink
feat(actions): add null check for current window in setup function (#69)
Browse files Browse the repository at this point in the history
This commit adds a null check for the current window in the setup function of the actions module. This ensures that the action is only performed if a valid window exists, improving the robustness of the code.
  • Loading branch information
jellydn committed Jun 11, 2024
1 parent 4ea2cdb commit 9a17567
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/edgy/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ function M.setup(win)
-- dont override existing mappings
if ret.buffer ~= 1 then
vim.keymap.set("n", key, function()
action(require("edgy.editor").get_win())
local current_win = require("edgy.editor").get_win()
if current_win ~= nil then
action(current_win)
end
end, { buffer = buf, silent = true })
end
end
Expand Down

0 comments on commit 9a17567

Please sign in to comment.