Fix T74295: Cloth + Internal springs crashes on a non-polygonal geometry

Added check to see if the mesh has any polygons at all.
If there are no polygons, the bvh tree data will consist of null
pointers, so skip internal springs if this is the case.
This commit is contained in:
Sebastian Parborg 2020-03-02 15:00:33 +01:00
parent 9c4523b1fd
commit 1648a79036

@ -1578,7 +1578,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
bool use_internal_springs = (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS); bool use_internal_springs = (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS);
if (use_internal_springs) { if (use_internal_springs && numpolys > 0) {
BVHTreeFromMesh treedata = {NULL}; BVHTreeFromMesh treedata = {NULL};
unsigned int tar_v_idx; unsigned int tar_v_idx;
BLI_bitmap *verts_used = NULL; BLI_bitmap *verts_used = NULL;