From da8a88f408a35b22bbd59c41d04e802278628aa2 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sat, 27 Dec 2014 17:05:42 +0100
Subject: ddraw: Don't call IDirect3DDevice7_DrawIndexedPrimitive if there is
 no primitive.

This is allowed to have execute buffer command drawing 0 primitive and this is covered by tests.
So just do nothing and avoid a useless error message triggered by the tests.
---
 dlls/ddraw/executebuffer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 4e9baad..5360c28 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -149,9 +149,10 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
                     buffer->indices[(i * 3) + 2] = ci->u3.v3;
                     instr += size;
                 }
-                IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface,
-                        D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, buffer->nb_vertices,
-                        buffer->indices, count * 3, 0);
+                if (count)
+                    IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface,
+                            D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, buffer->nb_vertices,
+                            buffer->indices, count * 3, 0);
 	    } break;
 
 	    case D3DOP_MATRIXLOAD:
-- 
2.1.3

