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

Type-checking when getting values #191

Closed
jasongin opened this issue Mar 22, 2017 · 1 comment
Closed

Type-checking when getting values #191

jasongin opened this issue Mar 22, 2017 · 1 comment
Assignees

Comments

@jasongin
Copy link
Member

There were a few questions in the PR about whether we need to check the type of a value before getting a casted value. For example, in napi_get_value_int32 we check value->IsNumber(), then call value.As<v8::Int32>()->Value(). What if the value is a non-integer number? Does the As<> cast work, or crash, or what?

Basically we need to add a bunch of test cases for these kinds of conversions, and add necessary type checks to avoid crashes. In my opinion, the APIs should not crash when provided a napi_value that is valid but the wrong type.

@jasongin
Copy link
Member Author

Fixed by #194

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