diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index d6bff962dfc..09cc3b653d4 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -4492,6 +4492,7 @@ static void test_CreateUri_InvalidArgs(void) { IUri *uri = (void*) 0xdeadbeef; const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0}; + static const WCHAR emptyW[] = {0}; hr = pCreateUri(http_urlW, 0, 0, NULL); ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG); @@ -4504,6 +4505,11 @@ static void test_CreateUri_InvalidArgs(void) { hr = pCreateUri(invalidW, 0, 0, &uri); ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG); ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri); + + uri = (void*) 0xdeadbeef; + hr = pCreateUri(emptyW, 0, 0, &uri); + ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG); + ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri); } static void test_CreateUri_InvalidUri(void) { diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index e2bec7033eb..43775481da6 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -4058,7 +4058,7 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU if(!ppURI) return E_INVALIDARG; - if(!pwzURI) { + if(!pwzURI || !*pwzURI) { *ppURI = NULL; return E_INVALIDARG; }