Skip to content

Commit

Permalink
🐛 Don't break filter on invalid word
Browse files Browse the repository at this point in the history
  • Loading branch information
richardfrost committed Sep 27, 2020
1 parent 735317c commit 8bc3ee1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/script/lib/wordlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ export default class Wordlist {
sorted.forEach(wordStr => {
// wordlistId = 0 includes all words
if (wordlistId === 0 || !Array.isArray(cfg.words[wordStr].lists) || cfg.words[wordStr].lists.includes(wordlistId)) {
self.list.push(wordStr);
let word = new Word(wordStr, cfg.words[wordStr], cfg);
self.all.push(word);
self.regExps.push(word.regExp);
let word;
try {
word = new Word(wordStr, cfg.words[wordStr], cfg);
self.list.push(wordStr);
self.all.push(word);
self.regExps.push(word.regExp);
} catch (e) {
// eslint-disable-next-line no-console
console.error(`APF: failed to add word: '${wordStr}'`);
}
}
});
}
Expand Down

0 comments on commit 8bc3ee1

Please sign in to comment.