From 7543fa04f189e57eb56c7d697920342e8f28b0de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Sun, 10 Jan 2016 17:59:00 +0100
Subject: wined3d: Ignore invalid render states.

---
 dlls/wined3d/device.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7c5a4c2..b0f4bf4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2027,10 +2027,17 @@ static void resolve_depth_buffer(struct wined3d_state *state)
 void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
         enum wined3d_render_state state, DWORD value)
 {
-    DWORD old_value = device->state.render_states[state];
+    DWORD old_value;
 
     TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
 
+    if (state > WINEHIGHEST_RENDER_STATE)
+    {
+        WARN("Ignoring unrecognized render state %#x, value %#x.\n", state, value);
+        return;
+    }
+
+    old_value = device->state.render_states[state];
     device->update_state->render_states[state] = value;
 
     /* Handle recording of state blocks. */
-- 
2.6.4

