-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels