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

vbscript: Fix handling null argument in CStr.

parent c9a606fa
......@@ -528,6 +528,9 @@ static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
TRACE("%s\n", debugstr_variant(arg));
if(V_VT(arg) == VT_NULL)
return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
hres = to_string(arg, &str);
if(FAILED(hres))
return hres;
......
......@@ -129,6 +129,14 @@ TestCStr 3, "3"
if isEnglishLang then TestCStr 3.5, "3.5"
if isEnglishLang then TestCStr true, "True"
sub testCStrError()
on error resume next
Error.clear()
CStr(null)
call ok(Err.number = 94, "Err.number = " & Err.number)
end sub
call testCStrError()
Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255)))
Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120))
......
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