Handle stack overflow caused by wanakana.toKana (#615)

This commit is contained in:
toasted-nutbread 2020-06-21 15:50:50 -04:00 committed by GitHub
parent 6562d0c1e5
commit 713bf29377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}