Skip to content

Commit

Permalink
Guard against frequency dicts with values of 0 or less (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube authored Sep 20, 2024
1 parent 43e9e84 commit 6b7218d
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 6b7218d

Please sign in to comment.