From 1be81205d0fbab529f9a7e4112912e8f2c57177d Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Wed, 21 Oct 2015 20:24:15 -0700 Subject: [PATCH] check for undefined was already covered --- src/RJSUtil.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/RJSUtil.hpp b/src/RJSUtil.hpp index 598e0aea..2f3754b8 100644 --- a/src/RJSUtil.hpp +++ b/src/RJSUtil.hpp @@ -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);