Christian Costa : d3drm: Fix vertex index test and print a warning when it is out of range.

Alexandre Julliard julliard at winehq.org
Mon Jun 11 15:08:06 CDT 2012


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

Author: Christian Costa <titan.costa at gmail.com>
Date:   Fri Jun  8 15:38:25 2012 +0200

d3drm: Fix vertex index test and print a warning when it is out of range.

---

 dlls/d3drm/meshbuilder.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c
index bdb5e00..1bb84c5 100644
--- a/dlls/d3drm/meshbuilder.c
+++ b/dlls/d3drm/meshbuilder.c
@@ -1366,8 +1366,11 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
             else
             {
                 DWORD vertex_idx = *faces_vertex_idx_ptr;
-                if (vertex_idx > This->nb_vertices)
+                if (vertex_idx >= This->nb_vertices)
+                {
+                    WARN("Found vertex index %u but only %u vertices available => use index 0\n", vertex_idx, This->nb_vertices);
                     vertex_idx = 0;
+                }
                 *(faces_data_ptr + faces_data_size++) = vertex_idx;
                 /* Add face normal to vertex normal */
                 D3DRMVectorAdd(&This->pNormals[vertex_idx], &This->pNormals[vertex_idx], &face_normal);




More information about the wine-cvs mailing list