Mesh Batch Cache: Fix use of uninitialized variable
authorClément Foucault <foucault.clem@gmail.com>
Sat, 11 May 2019 14:49:17 +0000 (16:49 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 14 May 2019 08:57:03 +0000 (10:57 +0200)
source/blender/draw/intern/draw_cache_impl_mesh.c

index 02930d38b041b9aec8888ac3e86283ebee7a196e..88ac20b75328420b207506d87e27aa25271702a5 100644 (file)
@@ -4729,14 +4729,18 @@ static void uvedit_fill_buffer_data(MeshRenderData *rdata,
           GPU_indexbuf_add_generic_vert(elb_face, vidx);
           GPU_indexbuf_add_primitive_restart(elb_face);
         }
-        if (elb_edge && e_origindex[l[i].e] != ORIGINDEX_NONE) {
+        if (elb_edge) {
           for (i = 0; i < mpoly->totloop; ++i) {
-            GPU_indexbuf_add_line_verts(elb_edge, vidx + i, vidx + (i + 1) % mpoly->totloop);
+            if (e_origindex[l[i].e] != ORIGINDEX_NONE) {
+              GPU_indexbuf_add_line_verts(elb_edge, vidx + i, vidx + (i + 1) % mpoly->totloop);
+            }
           }
         }
-        if (elb_vert && v_origindex[l[i].v] != ORIGINDEX_NONE) {
+        if (elb_vert) {
           for (i = 0; i < mpoly->totloop; ++i) {
-            GPU_indexbuf_add_generic_vert(elb_vert, vidx + i);
+            if (v_origindex[l[i].v] != ORIGINDEX_NONE) {
+              GPU_indexbuf_add_generic_vert(elb_vert, vidx + i);
+            }
           }
         }
       }