diff --git a/dlls/amstream/amstream.c b/dlls/amstream/amstream.c index 293e2b917c..a78abee5d6 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/amstream.c @@ -397,7 +397,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream return hr; } -static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags) +static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR filename, DWORD flags) { IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); HRESULT ret = S_OK; @@ -407,14 +407,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* ifac PIN_DIRECTION pin_direction; const WCHAR sourceW[] = {'S','o','u','r','c','e',0}; - TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(pszFileName), dwFlags); + TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(filename), flags); + + if (!filename) + return E_POINTER; /* If Initialize was not called before, we do it here */ if (!This->pFilterGraph) ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL); if (SUCCEEDED(ret)) - ret = IGraphBuilder_AddSourceFilter(This->pFilterGraph, pszFileName, sourceW, &BaseFilter); + ret = IGraphBuilder_AddSourceFilter(This->pFilterGraph, filename, sourceW, &BaseFilter); if (SUCCEEDED(ret)) ret = IBaseFilter_EnumPins(BaseFilter, &EnumPins); diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 6a198e01c9..5121b35f82 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -412,6 +412,10 @@ static void test_media_streams(void) } } + /* Test open file with no filename */ + hr = IAMMultiMediaStream_OpenFile(pams, NULL, 0); + ok(hr == E_POINTER, "IAMMultiMediaStream_OpenFile returned %x instead of %x\n", hr, E_POINTER); + if (video_stream) IMediaStream_Release(video_stream); if (audio_stream)