-
Notifications
You must be signed in to change notification settings - Fork 34
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
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 checkvalue->IsNumber()
, then callvalue.As<v8::Int32>()->Value()
. What if the value is a non-integer number? Does theAs<>
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.The text was updated successfully, but these errors were encountered: