From 6b794565aa0658bafff40491cad05c01d1d65000 Mon Sep 17 00:00:00 2001 From: Germano Date: Thu, 14 Dec 2017 14:31:08 -0200 Subject: Fix crash with DispLists without vertices Wee must return VertBuffers even when its size is zero --- source/blender/draw/intern/draw_cache_impl_displist.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'source/blender/draw/intern/draw_cache_impl_displist.c') diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index 87ff52c951c..33c4a938a56 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -121,9 +121,6 @@ static void displist_indexbufbuilder_set(Gwn_IndexBufBuilder *elb, const DispLis Gwn_VertBuf *DRW_displist_vertbuf_calc_pos_with_normals(ListBase *lb) { const int tri_len = curve_render_surface_tri_len_get(lb); - if (tri_len == 0) { - return NULL; - } static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; @@ -191,16 +188,11 @@ Gwn_IndexBuf *DRW_displist_indexbuf_calc_triangles_in_order(ListBase *lb) Gwn_IndexBuf **DRW_displist_indexbuf_calc_triangles_in_order_split_by_material(ListBase *lb, uint gpumat_array_len) { - const int tri_len = curve_render_surface_tri_len_get(lb); - if (tri_len == 0) { - return NULL; - } - - const int vert_len = curve_render_surface_vert_len_get(lb); - Gwn_IndexBuf **shaded_triangles_in_order = MEM_callocN(sizeof(*shaded_triangles_in_order) * gpumat_array_len, __func__); + const int tri_len = curve_render_surface_tri_len_get(lb); - { + if (tri_len != 0) { + const int vert_len = curve_render_surface_vert_len_get(lb); int i; Gwn_IndexBufBuilder *elb = BLI_array_alloca(elb, gpumat_array_len); -- cgit v1.2.3