summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-04 01:20:00 +0200
committerAlon Levy <alon@pobox.com>2014-12-04 01:20:18 +0200
commitbdf090e325deb3b67148887f7f0279c00a80f8e6 (patch)
tree6829d7e070f242c8d7a0b3351e983587347b3df0 /src
parente47fd94a93e586cd38b58f3c047726fc366cf74e (diff)
search: chrome throws exceptions on malformed regular expressions
Diffstat (limited to 'src')
-rw-r--r--src/main.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.js b/src/main.js
index 1d27eda3..b20b0ee1 100644
--- a/src/main.js
+++ b/src/main.js
@@ -38,7 +38,13 @@ function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop,
// TODO: move me somewhere
$('#search').on('input', function(e) {
var text = this.value.trim(),
+ r;
+
+ try {
r = new RegExp(text); // TODO fails for quotes
+ } catch (e) {
+ return; // don't clear selection either
+ }
if (text.length > 0) {
selection.byVisitors(function (n) { return n.name.match(r); });
} else {