Commit f6d184fe authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

vbscript: Handle null arguments in DateSerial().

parent da966b4d
......@@ -2095,6 +2095,9 @@ static HRESULT Global_DateSerial(BuiltinDisp *This, VARIANT *args, unsigned args
assert(args_cnt == 3);
if (V_VT(args) == VT_NULL || V_VT(args + 1) == VT_NULL || V_VT(args + 2) == VT_NULL)
return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
hres = to_int(args, &year);
if (SUCCEEDED(hres))
hres = to_int(args + 1, &month);
......
......@@ -1972,12 +1972,23 @@ end sub
sub testDateSerialError()
on error resume next
dim x
call Err.clear()
call DateSerial(10000, 1, 1)
call ok(Err.number = 5, "Err.number = " & Err.number)
call Err.clear()
call DateSerial(-10000, 1, 1)
call ok(Err.number = 5, "Err.number = " & Err.number)
call Err.clear()
x = DateSerial(null, 1, 1)
call ok(Err.number = 94, "Err.number = " & Err.number)
call ok(getVT(x) = "VT_EMPTY*", "getVT = " & getVT(x))
call Err.clear()
call DateSerial(2000, null, 1)
call ok(Err.number = 94, "Err.number = " & Err.number)
call Err.clear()
call DateSerial(2000, 1, null)
call ok(Err.number = 94, "Err.number = " & Err.number)
end sub
call testDateSerial(100, 2, 1, 100, 2, 1)
......
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