Commit 76a7fe59 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

d3drm: Check for NULL pointer in d3drm_viewport2_GetDevice().

parent e66f8e8c
......@@ -2153,6 +2153,8 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport_Init(viewport, device1, frame, rc.left, rc.top, rc.right, rc.bottom);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
hr = IDirect3DRMViewport_GetDevice(viewport, NULL);
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport_Release(viewport);
ref4 = get_refcount((IUnknown *)d3drm1);
......@@ -2241,6 +2243,8 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport2_Init(viewport2, device3, frame3, rc.left, rc.top, rc.right, rc.bottom);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
hr = IDirect3DRMViewport2_GetDevice(viewport2, NULL);
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport2_Release(viewport2);
ref4 = get_refcount((IUnknown *)d3drm1);
......
......@@ -683,6 +683,9 @@ static HRESULT WINAPI d3drm_viewport2_GetDevice(IDirect3DRMViewport2 *iface, IDi
TRACE("iface %p, device %p.\n", iface, device);
if (!device)
return D3DRMERR_BADVALUE;
if (!viewport->device)
return D3DRMERR_BADOBJECT;
......@@ -698,6 +701,9 @@ static HRESULT WINAPI d3drm_viewport1_GetDevice(IDirect3DRMViewport *iface, IDir
TRACE("iface %p, device %p.\n\n", iface, device);
if (!device)
return D3DRMERR_BADVALUE;
if (!viewport->device)
return D3DRMERR_BADOBJECT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment