check for undefined was already covered

This commit is contained in:
Ari Lazier 2015-10-21 20:24:15 -07:00
parent ac544205a1
commit 1be81205d0
1 changed files with 2 additions and 4 deletions

View File

@ -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);