fix(#1087): handle searchcount failures (#1088)

Co-authored-by: Shadman <13149513+shadmansaleh@users.noreply.github.com>
This commit is contained in:
Alexander Courtis 2023-10-20 14:36:20 +11:00 committed by GitHub
parent 1dc8b44423
commit 2248ef254d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -19,8 +19,8 @@ function M:update_status()
return ''
end
local result = vim.fn.searchcount { maxcount = self.options.maxcount, timeout = self.options.timeout }
if next(result) == nil then
local ok, result = pcall(vim.fn.searchcount, { maxcount = self.options.maxcount, timeout = self.options.timeout })
if not ok or next(result) == nil then
return ''
end