krmanik / Anki-xiehanzi

Learn, read, write and practice Mandarin by drawing strokes in Anki Desktop, AnkiDroid and AnkiMobile with audio of HSK 2.0 (HSK1-6) and HSK 3.0 (HSK 1-9) characters.
https://krmanik.github.io/Anki-xiehanzi
Other
157 stars 17 forks source link

Generation fails for "旅鼠" #52

Closed faceleg closed 2 months ago

faceleg commented 2 months ago

Describe the bug Attempting to create a deck containing the word "旅鼠" fails with:

Cannot read properties of null (reading 'length') TypeError: Cannot read properties of null (reading 'length') at Object.pinyinAndZhuyin (webpack-internal:///./src/dict/pinyinzhuyin.ts:7:236) at fetchMeaningGoogleTranslate (webpack-internal:///./src/pages/create.tsx:41:2454) at async searchAndAdd (webpack-internal:///./src/pages/create.tsx:41:3426)

To Reproduce Steps to reproduce the behavior:

  1. Go to https://krmanik.github.io/Anki-xiehanzi/create and progress until you can enter words.
  2. Open console
  3. Add 旅鼠
  4. Nothing happens (there is an error in the console, different to the one posted above due to minification)

Expected behavior I expect the site to generate a card with "旅鼠"

Desktop (please complete the following information):

Additional context I don't know why the code is throwing the error:

        if (syllable === ',') {
            html += ' ,';
            text += ' ,';
            continue;
        }
krmanik commented 2 months ago

Fixed in https://github.com/krmanik/Anki-xiehanzi/commit/251023bfcef558cd9be3bf2e1c68e22f1a631e39