diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-06-21 15:50:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 15:50:50 -0400 |
commit | 713bf293778d0172c1eb176b9f07780064896908 (patch) | |
tree | 33d74d654f7d51f442e9756e10f9e702f762284b /ext | |
parent | 6562d0c1e507b17ab929ed9525666a08084404fa (diff) |
Handle stack overflow caused by wanakana.toKana (#615)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/search.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 75707e6c..08c02624 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -312,7 +312,14 @@ class DisplaySearch extends Display { } setQuery(query) { - const interpretedQuery = this.isWanakanaEnabled() ? wanakana.toKana(query) : query; + let interpretedQuery = query; + if (this.isWanakanaEnabled()) { + try { + interpretedQuery = wanakana.toKana(query); + } catch (e) { + // NOP + } + } this.query.value = interpretedQuery; this.queryParser.setText(interpretedQuery); } |