=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw: Check for NULL pointers in SetCurrentViewport.

Alexandre Julliard julliard at winehq.org
Tue Jan 29 12:35:41 CST 2013


Module: wine
Branch: master
Commit: 351730e2d681e57fb2e32447ebf9bf9f4acedcc7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=351730e2d681e57fb2e32447ebf9bf9f4acedcc7

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Jan 26 13:39:45 2013 +0100

ddraw: Check for NULL pointers in SetCurrentViewport.

---

 dlls/ddraw/device.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 92828aa..a65df42 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -1703,9 +1703,15 @@ static HRESULT WINAPI d3d_device3_SetCurrentViewport(IDirect3DDevice3 *iface, ID
 
     TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport3);
 
+    if (!vp)
+    {
+        WARN("Direct3DViewport3 is NULL, returning DDERR_INVALIDPARAMS\n");
+        return DDERR_INVALIDPARAMS;
+    }
+
     wined3d_mutex_lock();
     /* Do nothing if the specified viewport is the same as the current one */
-    if (This->current_viewport == vp )
+    if (This->current_viewport == vp)
     {
         wined3d_mutex_unlock();
         return D3D_OK;
@@ -1745,7 +1751,8 @@ static HRESULT WINAPI d3d_device2_SetCurrentViewport(IDirect3DDevice2 *iface, ID
 
     TRACE("iface %p, viewport %p.\n", iface, viewport);
 
-    return d3d_device3_SetCurrentViewport(&device->IDirect3DDevice3_iface, &vp->IDirect3DViewport3_iface);
+    return d3d_device3_SetCurrentViewport(&device->IDirect3DDevice3_iface,
+            vp ? &vp->IDirect3DViewport3_iface : NULL);
 }
 
 /*****************************************************************************




More information about the wine-cvs mailing list