From 30963eecfb3be0dd50624d54f2111e7f1ed49d6b Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Thu, 30 Jan 2020 07:56:00 -0500 Subject: Fix T73450, crash when adding segments on bevel. Needed to protect against a case where clamp overlap limited the offset to approximately zero, and the snap-to-pipe code would therefore encounter an almost degenerate profile and fail in matrix inversion. --- source/blender/bmesh/tools/bmesh_bevel.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index bc84c6872c4..d3b3541a539 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -4272,6 +4272,10 @@ static void snap_to_pipe_profile(BoundVert *vpipe, bool midline, float co[3]) copy_v3_v3(va, pro->start); copy_v3_v3(vb, pro->end); + if (compare_v3v3(va, vb, BEVEL_EPSILON_D)) { + copy_v3_v3(co, va); + return; + } /* Get a plane with the normal pointing along the beveled edge */ sub_v3_v3v3(edir, e->e->v1->co, e->e->v2->co); @@ -4280,13 +4284,8 @@ static void snap_to_pipe_profile(BoundVert *vpipe, bool midline, float co[3]) closest_to_plane_v3(va0, plane, va); closest_to_plane_v3(vb0, plane, vb); closest_to_plane_v3(vmid0, plane, pro->middle); - if (make_unit_square_map(va0, vmid0, vb0, m)) { + if (make_unit_square_map(va0, vmid0, vb0, m) && invert_m4_m4(minv, m)) { /* Transform co and project it onto superellipse */ - if (!invert_m4_m4(minv, m)) { - /* shouldn't happen */ - BLI_assert(!"failed inverse during pipe profile snap"); - return; - } mul_v3_m4v3(p, minv, co); snap_to_superellipsoid(p, pro->super_r, midline); -- cgit v1.2.3