From 8a04f30008696d2a1d29d30943ebce2174a2ebf9 Mon Sep 17 00:00:00 2001 From: Andrew Janssen Date: Fri, 8 Nov 2024 09:35:08 -0800 Subject: [PATCH] Fix: exception when search term is not a valid regex --- src/routes/+page.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 169237a..6a8242c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -68,7 +68,13 @@ const nameSubstringMatch = process.name .toLowerCase() .includes(term.toLowerCase()); - const nameRegexMatch = new RegExp(term, "i").test(process.name); + const nameRegexMatch = (() => { + try { + return new RegExp(term, "i").test(process.name); + } catch { + return false; + } + })(); const commandMatch = process.command .toLowerCase() .includes(term.toLowerCase());