Henri Verbeet : ddraw: Don' t return an error when setting a 0 material handle in d3d_device3_SetLightState ().

Alexandre Julliard julliard at winehq.org
Tue Apr 29 13:36:13 CDT 2014


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Apr 29 10:41:06 2014 +0200

ddraw: Don't return an error when setting a 0 material handle in d3d_device3_SetLightState().

---

 dlls/ddraw/device.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index e6f40a0..88142a9 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2945,16 +2945,19 @@ static HRESULT WINAPI d3d_device3_SetLightState(IDirect3DDevice3 *iface,
     wined3d_mutex_lock();
     if (state == D3DLIGHTSTATE_MATERIAL)
     {
-        struct d3d_material *m = ddraw_get_object(&device->handle_table, value - 1, DDRAW_HANDLE_MATERIAL);
-        if (!m)
+        if (value)
         {
-            WARN("Invalid material handle.\n");
-            wined3d_mutex_unlock();
-            return DDERR_INVALIDPARAMS;
-        }
+            struct d3d_material *m;
 
-        TRACE(" activating material %p.\n", m);
-        material_activate(m);
+            if (!(m = ddraw_get_object(&device->handle_table, value - 1, DDRAW_HANDLE_MATERIAL)))
+            {
+                WARN("Invalid material handle.\n");
+                wined3d_mutex_unlock();
+                return DDERR_INVALIDPARAMS;
+            }
+
+            material_activate(m);
+        }
 
         device->material = value;
     }




More information about the wine-cvs mailing list