From 713bf293778d0172c1eb176b9f07780064896908 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 21 Jun 2020 15:50:50 -0400 Subject: Handle stack overflow caused by wanakana.toKana (#615) --- ext/bg/js/search.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ext/bg') 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); } -- cgit v1.2.3