mfplay: Handle NULL item in SetMediaItem().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-10-22 08:22:59 +03:00 committed by Alexandre Julliard
parent c6c3d6f963
commit 66948f8934
2 changed files with 20 additions and 1 deletions

View File

@ -1224,12 +1224,16 @@ static HRESULT media_item_create_topology(struct media_player *player, struct me
static HRESULT WINAPI media_player_SetMediaItem(IMFPMediaPlayer *iface, IMFPMediaItem *item_iface)
{
struct media_player *player = impl_from_IMFPMediaPlayer(iface);
struct media_item *item = unsafe_impl_from_IMFPMediaItem(item_iface);
struct media_item *item;
IMFTopology *topology;
HRESULT hr;
TRACE("%p, %p.\n", iface, item_iface);
if (!item_iface)
return E_POINTER;
item = unsafe_impl_from_IMFPMediaItem(item_iface);
if (item->player != iface)
return E_INVALIDARG;

View File

@ -198,8 +198,23 @@ static void test_shutdown(void)
IMFPMediaPlayer_Release(player);
}
static void test_media_item(void)
{
IMFPMediaPlayer *player;
HRESULT hr;
hr = MFPCreateMediaPlayer(NULL, FALSE, 0, NULL, NULL, &player);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetMediaItem(player, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
IMFPMediaPlayer_Release(player);
}
START_TEST(mfplay)
{
test_create_player();
test_shutdown();
test_media_item();
}