fix: use pcall to prevent live-filter regex errors (#1689)
* fix: use pcall to prevent live-filter regex errors Wrap live filter's match function in pcall to prevent errors caused by invalid regex while typing. * nit: use ok for pcall rc * nit: stylua fix Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
parent
dd90bfa155
commit
3845039c1a
@ -76,7 +76,8 @@ function M.apply_filter(node_)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local has_nodes = nodes and (M.always_show_folders or #nodes > filtered_nodes)
|
local has_nodes = nodes and (M.always_show_folders or #nodes > filtered_nodes)
|
||||||
node.hidden = not (has_nodes or matches(node))
|
local ok, is_match = pcall(matches, node)
|
||||||
|
node.hidden = not (has_nodes or (ok and is_match))
|
||||||
end
|
end
|
||||||
|
|
||||||
iterate(node_ or TreeExplorer)
|
iterate(node_ or TreeExplorer)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user