Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
fix: telescope issue when no matches (#60)
Browse files Browse the repository at this point in the history
when there were no matches in the telescope search and the user pressed
enter, we had a crash
  • Loading branch information
emmanueltouzery authored Oct 23, 2023
1 parent 58239a5 commit 382e171
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lua/nvim-devdocs/pickers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ local metadata_previewer = previewers.new_buffer_previewer({

local doc_previewer = previewers.new_buffer_previewer({
title = "Preview",
keep_last_buf = true,
define_preview = function(self, entry)
local bufnr = self.state.bufnr

Expand Down Expand Up @@ -160,12 +159,14 @@ M.open_picker = function(entries, float)
actions.close(prompt_bufnr)

local selection = action_state.get_selected_entry()
local name = selection.value.name
local match = name:match("%[([^%]]+)%]")
if selection then
local name = selection.value.name
local match = name:match("%[([^%]]+)%]")

if match then plugin_state.set("current_doc", match) end
if match then plugin_state.set("current_doc", match) end

open_doc(selection, float)
open_doc(selection, float)
end
end)
return true
end,
Expand Down

0 comments on commit 382e171

Please sign in to comment.