Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stringToUtf8Bytes may return null #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alpaca-tc
Copy link

Fix TypeError: Cannot read properties of null (reading 'length').
I have not been able to reproduce the bug but it seems that stringToUtf8Bytes may return null.

stringToUtf8Bytes returns null ↓
https://github.com/takuyaa/doublearray//blob/461f142db0e9111672e5528770546052a7a1ec30/doublearray.js#L685-L685


By the way, the error occurred while processing a string containing emoji like '😂' with kuromoji.

TypeError: Cannot read properties of null (reading 'length')
    at DoubleArray.commonPrefixSearch ((...)/doublearray/doublearray.js:559:36)
    at ViterbiBuilder.build ((...)/node_modules/kuromoji/src/viterbi/ViterbiBuilder.js:47:36)
    at Tokenizer.getLattice ((...)/node_modules/kuromoji/src/Tokenizer.js:126:33)
    at Tokenizer.tokenizeForSentence ((...)/node_modules/kuromoji/src/Tokenizer.js:81:24)
    ...

@alpaca-tc
Copy link
Author

@takuyaa Today, I confirmed it happens when using 🍪.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant