fix: Crash with some find characters

fix: Warning on close of find dialog
This commit is contained in:
Tom Moor
2023-08-03 19:32:09 -04:00
parent b691311f88
commit 7c15d03b50
2 changed files with 10 additions and 1 deletions

View File

@@ -141,7 +141,14 @@ export default class FindAndReplace extends Extension {
}
private get findRegExp() {
return RegExp(this.searchTerm, !this.options.caseSensitive ? "gui" : "gu");
try {
return RegExp(
this.searchTerm.replace(/\\+$/, ""),
!this.options.caseSensitive ? "gui" : "gu"
);
} catch (err) {
return RegExp("");
}
}
private goToMatch(direction: number): Command {