diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 4144ef51716..501ccfca1d5 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -2257,6 +2257,8 @@ static HRESULT WINAPI fnIMultiLanguage_GetRfc1766FromLcid( WCHAR buf[MAX_RFC1766_NAME]; TRACE("%p %04x %p\n", iface, lcid, pbstrRfc1766); + if (!pbstrRfc1766) + return E_INVALIDARG; if (!lcid_to_rfc1766W( lcid, buf, MAX_RFC1766_NAME )) { @@ -2812,6 +2814,8 @@ static HRESULT WINAPI fnIMultiLanguage2_GetRfc1766FromLcid( WCHAR buf[MAX_RFC1766_NAME]; TRACE("%p %04x %p\n", iface, lcid, pbstrRfc1766); + if (!pbstrRfc1766) + return E_INVALIDARG; if (!lcid_to_rfc1766W( lcid, buf, MAX_RFC1766_NAME )) { diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index bf211466973..829af24cdcf 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -966,6 +966,9 @@ static void test_GetRfc1766FromLcid(IMultiLanguage2 *iML2) SysFreeString(rfcstr); } + + hr = IMultiLanguage2_GetRfc1766FromLcid(iML2, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NULL); + ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr); } static void test_IMultiLanguage2_ConvertStringFromUnicode(IMultiLanguage2 *iML2)