Commit a8c7e97d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Fixed to_object for NULL IDispatch.

parent 1a6aa963
......@@ -603,8 +603,18 @@ HRESULT to_object(script_ctx_t *ctx, VARIANT *v, IDispatch **disp)
*disp = (IDispatch*)_IDispatchEx_(dispex);
break;
case VT_DISPATCH:
IDispatch_AddRef(V_DISPATCH(v));
*disp = V_DISPATCH(v);
if(V_DISPATCH(v)) {
IDispatch_AddRef(V_DISPATCH(v));
*disp = V_DISPATCH(v);
}else {
DispatchEx *obj;
hres = create_object(ctx, NULL, &obj);
if(FAILED(hres))
return hres;
*disp = (IDispatch*)_IDispatchEx_(obj);
}
break;
case VT_BOOL:
hres = create_bool(ctx, V_BOOL(v), &dispex);
......
......@@ -948,6 +948,11 @@ ok(!nullDisp === true, "!nullDisp = " + !nullDisp);
ok(String(nullDisp) === "null", "String(nullDisp) = " + String(nullDisp));
ok(nullDisp != new Object(), "nullDisp == new Object()");
ok(new Object() != nullDisp, "new Object() == nullDisp");
ok((typeof Object(nullDisp)) === "object", "typeof Object(nullDisp) !== 'object'");
tmp = getVT(Object(nullDisp));
ok(tmp === "VT_DISPATCH", "getVT(Object(nullDisp) = " + tmp);
tmp = Object(nullDisp).toString();
ok(tmp === "[object Object]", "Object(nullDisp).toString() = " + tmp);
function do_test() {}
function nosemicolon() {} nosemicolon();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment