keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
403 stars 112 forks source link

bug(developer): missing wordlist file causes `TypeError: Cannot read properties of null (reading 'length')` #12553

Closed sentry-io[bot] closed 2 weeks ago

sentry-io[bot] commented 1 month ago

Sentry Issue: KEYMAN-DEVELOPER-294

TypeError: Cannot read properties of null (reading 'length')
  File "D:\Projects\keyman\app\developer\src\kmc-model\src\build-trie.ts", line 502, in detectEncoding
    if(buffer.length < 2) {
  File "D:\Projects\keyman\app\developer\src\kmc-model\src\build-trie.ts", line 172, in WordListFromFilename.lines
    const contents = new TextDecoder(detectEncoding(data)).decode(data);
  File "D:\Projects\keyman\app\developer\src\kmc-model\src\build-trie.ts", line 95, in _parseWordList
    for (let [lineno, line] of source.lines()) {
  File "D:\Projects\keyman\app\developer\src\kmc-model\src\build-trie.ts", line 49, in parseWordListFromFilename
    _parseWordList(wordlist, new WordListFromFilename(filename));
  File "D:\Projects\keyman\app\developer\src\kmc-model\src\build-trie.ts", line 30, in <anonymous>
    filenames.forEach(filename => parseWordListFromFilename(wordlist, filename));
...
(5 additional frame(s) were not displayed)

This arises when we have a .model.ts that references a missing .tsv file.