Skip to content

Commit

Permalink
fix: avoid crash when there is no selection
Browse files Browse the repository at this point in the history
This just changes the guard here to make sure that if the user
doesn't select anything with the telescope extension that instead
of crashing we just do nothing.

Fixes #606
  • Loading branch information
ckipp01 committed Sep 18, 2023
1 parent e90c087 commit 81c4b4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/telescope/_extensions/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ local pickers = require("telescope.pickers")
local function execute_command(bufnr)
local selection = action_state.get_selected_entry(bufnr)
actions.close(bufnr)
local cmd = selection.command
if cmd then
if selection then
local cmd = selection.command
local success, msg = pcall(cmd)
if not success then
vim.api.nvim_notify(msg, 2, {})
Expand Down

0 comments on commit 81c4b4f

Please sign in to comment.