check for undefined was already covered
This commit is contained in:
parent
ac544205a1
commit
1be81205d0
|
@ -127,13 +127,11 @@ static inline JSObjectRef RJSValidatedValueToFunction(JSContextRef ctx, JSValueR
|
|||
}
|
||||
|
||||
static inline double RJSValidatedValueToNumber(JSContextRef ctx, JSValueRef value) {
|
||||
JSValueRef exception = NULL;
|
||||
if (JSValueIsUndefined(ctx, value)) {
|
||||
throw std::invalid_argument("`undefined` is not a number.");
|
||||
}
|
||||
if (JSValueIsNull(ctx, value)) {
|
||||
throw std::invalid_argument("`null` is not a number.");
|
||||
}
|
||||
|
||||
JSValueRef exception = NULL;
|
||||
double number = JSValueToNumber(ctx, value, &exception);
|
||||
if (exception) {
|
||||
throw RJSException(ctx, exception);
|
||||
|
|
Loading…
Reference in New Issue