mirror of
https://github.com/kunkunsh/kunkun-ext-neohtop.git
synced 2025-04-11 17:29:45 +00:00
Fix: exception when search term is not a valid regex
This commit is contained in:
parent
5082a5087a
commit
8a04f30008
@ -68,7 +68,13 @@
|
|||||||
const nameSubstringMatch = process.name
|
const nameSubstringMatch = process.name
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(term.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
|
const commandMatch = process.command
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(term.toLowerCase());
|
.includes(term.toLowerCase());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user