diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index c6f4b9c934a..2adfcb7acd9 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + #include #include "jscript.h" @@ -325,6 +328,9 @@ static HRESULT str_to_number(BSTR str, VARIANT *ret) HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret) { switch(V_VT(v)) { + case VT_EMPTY: + num_set_nan(ret); + break; case VT_NULL: V_VT(ret) = VT_I4; V_I4(ret) = 0; diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index 5f14eb15c91..5d53320f57a 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -790,5 +790,6 @@ ok(isNaN(0.5) === false, "isNaN(0.5) !== false"); ok(isNaN() === true, "isNaN() !== true"); ok(isNaN(NaN, 0) === true, "isNaN(NaN, 0) !== true"); ok(isNaN(0.5, NaN) === false, "isNaN(0.5, NaN) !== false"); +ok(isNaN(+undefined) === true, "isNaN(+undefined) !== true"); reportSuccess();