From 6b7218dff0af4ad50a31abf1289484f07695015c Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:04:46 -0400 Subject: [PATCH] Guard against frequency dicts with values of 0 or less (#1437) --- ext/js/data/anki-note-data-creator.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index 4c6576322c..c4fd44f747 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -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; }