Skip to content

Commit

Permalink
Guard against frequency dicts with values of 0 or less
Browse files Browse the repository at this point in the history
<rikaitan.link>NmI3MjE4ZGZmMGFmNGFkNTBhMzFhYmYxMjg5NDg0ZjA3Njk1MDE1Ywo=</rikaitan.link>
  • Loading branch information
jason-ojisan committed Sep 21, 2024
1 parent 5fa6dcc commit 1f3d8fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ext/js/data/anki-note-data-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,16 @@ function getFrequencyNumbers(dictionaryEntry) {
if (displayValue !== null) {
const frequencyMatch = displayValue.match(/\d+/);
if (frequencyMatch !== null) {
frequencies.push(Number.parseInt(frequencyMatch[0], 10));
continue;
const frequencyParsed = Number.parseInt(frequencyMatch[0], 10);
if (frequencyParsed > 0) {
frequencies.push();
continue;
}
}
}
frequencies.push(frequency);
if (frequency > 0) {
frequencies.push(frequency);
}
}
return frequencies;
}
Expand Down

0 comments on commit 1f3d8fe

Please sign in to comment.