Skip to content

Commit

Permalink
fix: searchcount exception on invalid search regex (#2693)
Browse files Browse the repository at this point in the history
* fix: wrap searchcount in pcall to avoid error

* fix: searchcount in pcall

---------

Co-authored-by: xVermillionx <xVermillionx@notvalid>
  • Loading branch information
xVermillionx and xVermillionx authored Mar 9, 2024
1 parent efafd73 commit 041dbd1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function M.open_on_directory()
end

function M.place_cursor_on_node()
local search = vim.fn.searchcount()
if search and search.exact_match == 1 then
local ok, search = pcall(vim.fn.searchcount)
if ok and search and search.exact_match == 1 then
return
end

Expand Down

0 comments on commit 041dbd1

Please sign in to comment.