Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/vbscript/global.c | 3 +++ dlls/vbscript/tests/api.vbs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 80348a5288f..876a41a14b2 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -2897,6 +2897,9 @@ static HRESULT Global_MonthName(BuiltinDisp *This, VARIANT *args, unsigned args_
assert(args_cnt == 1 || args_cnt == 2);
+ if(V_VT(args) == VT_NULL || (args_cnt == 2 && V_VT(args+1) == VT_NULL)) + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + hres = to_int(args, &month); if(FAILED(hres)) return hres; diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 617589053c6..758013c93ef 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -2148,4 +2148,21 @@ call testWeekday(DateSerial(2000, 1, 1), vbFriday, 2) call testWeekday(DateSerial(2000, 1, 1), vbSaturday, 1) call testWeekdayError()
+sub testMonthNameError() + on error resume next + call Err.clear() + call MonthName(null) + call ok(Err.number = 94, "Err.number = " & Err.number) + call Err.clear() + call MonthName(1, null) + call ok(Err.number = 94, "Err.number = " & Err.number) + call Err.clear() + call MonthName(null, null) + call ok(Err.number = 94, "Err.number = " & Err.number) + call Err.clear() + call MonthName("a", null) + call ok(Err.number = 94, "Err.number = " & Err.number) +end sub +call testMonthNameError() + Call reportSuccess()