mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-24 20:28:23 +00:00
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…
x
Reference in New Issue
Block a user