From a287c8d3c160ba448424905a201c75fd97f9182a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 26 Jun 2021 16:55:14 +1000 Subject: BMesh: skip partial updates when there is nothing to do --- source/blender/bmesh/intern/bmesh_mesh_tessellate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/bmesh/intern/bmesh_mesh_tessellate.c') diff --git a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c index c9b027474e1..9f477bc8a9c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c +++ b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c @@ -406,6 +406,10 @@ void BM_mesh_calc_tessellation_with_partial_ex(BMesh *bm, const struct BMeshCalcTessellation_Params *params) { BLI_assert(bmpinfo->params.do_tessellate); + /* While harmless, exit early if there is nothing to do (avoids ensuring the index). */ + if (UNLIKELY(bmpinfo->faces_len == 0)) { + return; + } BM_mesh_elem_index_ensure(bm, BM_LOOP | BM_FACE); -- cgit v1.2.3