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

No null checking when accountFetcher returns Promise #3

Open
dmitrij-borchuk opened this issue Apr 14, 2024 · 0 comments
Open

No null checking when accountFetcher returns Promise #3

dmitrij-borchuk opened this issue Apr 14, 2024 · 0 comments

Comments

@dmitrij-borchuk
Copy link

Looks like I have found a bug. When accountFetcher returns Promise there is no null checking.

Code example.

tokenize.validate(token, async (id, prefix) => {
  return null
})

This code raises an exception TypeError: Cannot convert undefined or null to object.

Here (https://github.com/cyyynthia/tokenize/blob/mistress/index.js#L117) we have checked for a null but in the case of Promise, this checking will pass value further. Later (https://github.com/cyyynthia/tokenize/blob/mistress/index.js#L120) it will pass the null to _finishValidation where the error raises.

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

No branches or pull requests

1 participant